-
Notifications
You must be signed in to change notification settings - Fork 440
[Symfony] sendCommand / sendEvent for delayed message have different behaviour #523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@amenophis the message is being delayed twice right? I think that a router should reset any priority, delaying, and expiration while sending the message to its final destination. |
@makasim Yes, the message is delayed first for 120s in the This behaviour appear only while sending command, not event. |
I don't understand why the |
rabbitmq does not support message delaying out of the box. We have to two options: a workaround based on dead letter queue and time to live features and the plugin. You are using a kind of "work around" which needs a queue to be created |
I understand how the delayed feature work, but i don't understand why 2 queues are needed with Command and just 1 queue with Event |
Could you post a code where you register an event and command processors? I guess it should the other way around. |
@makasim You can see code below. This is the Processors <?php
namespace AppBundle\Async\Processor;
use AppBundle\Entity\WebhookJob;
use AppBundle\WebhookJobRunner;
use Enqueue\Client\CommandSubscriberInterface;
use Enqueue\Client\TopicSubscriberInterface;
use Interop\Queue\PsrContext;
use Interop\Queue\PsrMessage;
use Interop\Queue\PsrProcessor;
class WebhookExecuteProcessor implements PsrProcessor, TopicSubscriberInterface
{
public static function getSubscribedTopics()
{
return [
'webhook.job_execute' => ['queueName' => 'job_execute']
];
}
protected $runner;
public function __construct(WebhookJobRunner $runner)
{
$this->runner = $runner;
}
public function process(PsrMessage $message, PsrContext $context)
{
$this->runner->run($message->getBody());
return self::ACK;
}
}
class WebhookExecuteProcessor2 implements PsrProcessor, CommandSubscriberInterface
{
public static function getSubscribedCommand()
{
return [
'processorName' => 'webhook.job_execute',
'queueName' => 'job_execute',
];
}
protected $runner;
public function __construct(WebhookJobRunner $runner)
{
$this->runner = $runner;
}
public function process(PsrMessage $message, PsrContext $context)
{
$this->runner->run($message->getBody());
return self::ACK;
}
} And this is the runner used in the Processors <?php
namespace AppBundle;
use Enqueue\Client\Message;
use Enqueue\Client\ProducerInterface;
class WebhookJobRunner
{
protected $producer;
public function __construct(ProducerInterface $producer)
{
$this->producer = $producer;
}
public function run(string $jobId): void
{
// ...
$message = new Message($jobId);
$message->setDelay(120);
$this->producer->sendEvent('webhook_job.execute', $message);
$this->producer->sendCommand('webhook_job.execute', $message);
}
} |
@makasim any updates on this issue ? |
fixes php-enqueue/enqueue-dev#523 (for amqp)
Thanks @makasim. When do you plan the next release ? |
I was almost ready to release a stable version (3-5 days left). Now I am involved in a project development. Not sure when it happens. |
Hi,
we are trying to use
RabbitMqDlxDelayStrategy
with therabbitmq_amqp
transport in a symfony project. Our config looks like that:With
sendEvent
, the delayed message is pushed inenqueue.company.webhook.job_execute.120000.delayed
for 120s, and then delivered to thecompany.webhook.job_execute
queue.With
sendCommand
, the delayed message is pushed inenqueue.company.webhook.router.120000.delayed
for 120s. After the 120s it is sent toenqueue.company.webhook.job_execute.120000.delayed
for 120s, and then delivered to thecompany.webhook.job_execute
queue.In both cases, we use the autowired
ProducerInterface
tosendEvent
/sendCommand
.We are waiting for the same behaviour with Event or Command (The actual Event behaviour)
Is it a normal behaviour ? Is it a bug ?
Thanks
The text was updated successfully, but these errors were encountered: