Symfony Messenger Long Running Worker and AMQP Heartbeat

692 Views Asked by At

In a messenger handler, if the message takes longer to process than the heartbeat, you won't be able to ack the message due to the connection going away.

Is there a way in the handler to manually keep the connection alive? Is publishing a message to a "ping" queue enough?

Example:

public function __invoke(SampleMessage $message)
{
    foreach ($message->listOfSomething() as $something) {
        $this->reallyLongRunningTask($something);
        $this->messageBus->dispatch(new PingMessage());
    }
}

Thanks in advance

0

There are 0 best solutions below