Skip to content

[Question] [php-amqp RabbitMQ] Is it possible to have message processors with automatic acknowledgement? #1115

Closed
@renatogcarvalho

Description

@renatogcarvalho

Hello,

I have a Symfony application configured using php-amqp and RabbitMQ with:

  1. A general queue dedicated for messages from an API of which I have hundreds of message processors running on dedicated pool of queue worker servers, using a configuration similar to your documentation: https://php-enqueue.github.io/consumption/message_processor/

  2. A "reply queue" that is created during each API request that is used to forward the results from the messages consumed by the processors, which during onKernelTerminate is deleted.

My main goal is increase the throughput of my consumers, since I don't really need to worry about persistence on this workflow. The queue configured on item 1 is expected to receive millions of messages (10m+ or more) every day.

For the "reply queues" configured for item 2 I was able to set a NOACK flag in the consumer as follows:

$replyConsumer = $this->producer
->getContext()
->createConsumer($replyQueue)
;

$replyConsumer->setFlags(AmqpConsumer::FLAG_NOACK);

I wonder if there is a way that I can also set this flag somehow to the message processors? Or do you think I should maybe consider taking a different approach? What I most like about it (thanks to you!!!) is the convenience of running the CLI commands and be able to tie signals and use the extensions to watch for max execution time and memory usage.

Also, would you have any recommendation for this setup regarding the qos_prefetch_count connection setting? I currently have it set to 1 as I have hundreds of processors to go through these messages, but I wonder if increasing this setting would help it somehow.

Much appreciated your feedback.

Thanks.

-R.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions