Open MrSnoozles opened 6 months ago
Hi,
I noticed that when I start multiple consumers the same messages are executed by the consumers. Is there a way to "reserve" a message? I'm using Dbal to store the messages in a MariaDB database.
How I dispatch the messages
$queue = $context->createQueue('default'); $message = $context->createMessage($messageContent); $producer = $context->createProducer(); $producer->send($queue, $message);
How I consume the messages
// bin/start-worker.php /* @var $context DbalContext */ $subscriptionConsumer = $context->createSubscriptionConsumer(); $queue = $context->createQueue('default'); $consumer = $context->createConsumer($queue); $subscriptionConsumer->subscribe( $consumer, function (Message $message, Consumer $consumer) { $job = unserialize($message->getBody()); $job->handle(); $consumer->acknowledge($message); } ); $subscriptionConsumer->consume(0);
Now running php bin/start-worker.php multiple times will lead to the same messages being picked up several times. Am I understanding something wrong?
php bin/start-worker.php
Hi,
I noticed that when I start multiple consumers the same messages are executed by the consumers. Is there a way to "reserve" a message? I'm using Dbal to store the messages in a MariaDB database.
How I dispatch the messages
How I consume the messages
Now running
php bin/start-worker.php
multiple times will lead to the same messages being picked up several times. Am I understanding something wrong?