jobqueue-common icon indicating copy to clipboard operation
jobqueue-common copied to clipboard

Better interface to integrate RabbitMQ

Open dfeyer opened this issue 8 years ago • 3 comments

I have a project that need to use RabbitMQ, currently the JobQueue package, connect to the queue server for each message, it's not really efficient.

RabbitMQ offers API to use closure to consume message, with connection/deconnection between each message, its more efficiant and allow more monitoring of the consumer, because the connection lives a long time.

Any idea how we can extend the JobQueue package to support this kind of case ?

See this consumer example https://github.com/php-amqplib/php-amqplib/blob/master/demo/amqp_consumer.php#L67

dfeyer avatar Oct 20 '17 11:10 dfeyer

@dfeyer when you write "for each message" you are talking about consuming messages, right? So basically this part in your implementation: https://github.com/ttreeagency/Flowpack.JoqQueue.RabbitMQ/blob/master/Classes/RabbitQueue.php#L92-L125

The main entry point for these methods is JobManager::waitAndExecute() which is called in an endless loop by the work CLI command. So we would need to turn that around to allow the queue to invoke a callback for new messages, right?

bwaidelich avatar Oct 20 '17 12:10 bwaidelich

Yes, the AMQP prototocol is heavy and if we can avoid the to repeat the connection process for every message, it could be really nice

dfeyer avatar Oct 20 '17 12:10 dfeyer

I push a new version of my RabbitMQ integration, a bit more efficiant by using AMQP wait function and proper QoS configuration.

dfeyer avatar Oct 20 '17 12:10 dfeyer