SQS messages not consumed #1862
Answered
by
rustatian
QuietImprovement
asked this question in
Q&A
-
Hi All, With this current YAML config version: "2.7"
#
# RPC is required for tasks dispatching (client)
#
rpc:
listen: tcp://127.0.0.1:6001
#
# This section configures the task consumer (server)
#
server:
command: php consumer.php
relay: pipes
sqs:
# Required AccessKey ID.
# Default: empty
key: mykey
# Required secret access key.
# Default: empty
secret: mysecret
# Required AWS region.
# Default: empty
region: eu-central-1
# Required AWS SQS endpoint to connect.
# Default: http://127.0.0.1:9324
endpoint: https://sqs.eu-central-1.amazonaws.com
#
# In this section, the jobs themselves are configured
#
jobs:
num_pollers: 10
pipeline_size: 100000
pool:
num_workers: 10
max_jobs: 0
allocate_timeout: 60s
destroy_timeout: 60s
consume: ["my-queue-name"]
pipelines:
test-sqs-pipeline:
# Required section.
# Should be "sqs" for the Amazon SQS driver.
driver: sqs
config:
# Optional section.
# Default: 10
prefetch: 10
# Consume any payload type (not only Jobs structured)
# Default: false
consume_all: true
# Get queue URL only
# Default: false
skip_queue_declaration: true
# Optional section.
# Default: 0
#visibility_timeout: 0
# Optional section.
# Default: 0
#wait_time_seconds: 0
# Optional section.
# Default: default
queue: "my-queue-name"
# Message group ID: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessage.html#SQS-SendMessage-request-MessageGroupId
# Default: empty, should be set if FIFO queue is used
# message_group_id: "test"
# Optional section.
# Default: empty
#attributes:
# DelaySeconds: 42
# etc... see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SetQueueAttributes.html
# Optional section.
# Default: empty
#tags:
# test: "tag"
logs:
level: debug and this consumer.php <?php
declare(strict_types=1);
use Spiral\RoadRunner\Environment;
use Spiral\RoadRunner\Environment\Mode;
use Spiral\RoadRunner\Jobs\Consumer;
use Spiral\RoadRunner\Jobs\Task\ReceivedTaskInterface;
use Spiral\RoadRunner\Jobs\Jobs;
use Spiral\Goridge\RPC\RPC;
require_once 'vendor/autoload.php';
(static function (): void {
$env = Environment::fromGlobals();
$isJobsMode = $env->getMode() === Mode::MODE_JOBS;
$shouldBeRestarted = false;
if ($isJobsMode) {
$consumer = new Consumer();
/** @var Spiral\RoadRunner\Jobs\Task\ReceivedTaskInterface $task*/
while ($task = $consumer->waitTask()) {
try {
var_dump($task);
$task->complete();
} catch (\Throwable $e) {
$task->fail($e, $shouldBeRestarted);
}
}
}
})(); I can see in the logs
There are some messages on the queue But there is no reaction from RR in the logs ... |
Beta Was this translation helpful? Give feedback.
Answered by
rustatian
Feb 6, 2024
Replies: 1 comment 1 reply
-
Hey @QuietImprovement 👋 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Moreover, there is an error in your config. You should consume pipelines, not queues.