vyuldashev / laravel-queue-rabbitmq

RabbitMQ driver for Laravel Queue. Supports Laravel Horizon.
MIT License
1.92k stars 378 forks source link

How to develop a consumer ? #597

Open alissonpadua opened 3 months ago

alissonpadua commented 3 months ago

Hello everyone! I hope you're doing well!! I have 2 laravel apps, one producing data (via Job) and another one I would like to consume data from the queue whenever it has messages there (also ack the message). The producer I manage to make it works following the docs, but the consumer I didn't unfortunately. Do you have any example of a consumer ? It can use event, jobs, listerners I don't mind =))

Thank you!!

mrrezakarimi99 commented 3 months ago

Hi @alissonpadua, I hope you are doing well. Could you please send the error message from the second application that is consuming queues? I believe I can assist you with this situation.

alissonpadua commented 3 months ago

Hi @alissonpadua, I hope you are doing well. Could you please send the error message from the second application that is consuming queues? I believe I can assist you with this situation.

Actually there is no error, I'm just not sure the best way to implement it. Maybe that is not the pourpose of the lib ?

khepin commented 3 months ago

This library implements the same interfaces as all Laravel queue implementations. This means the documentation to be followed is the one from Laravel. Note that Laravel serializes and de-serializes job classes so you'll need to have the same code (same job class) in both applications for your use case.

I would also suggest using the rabbit admin UI to validate that your messages are correctly being sent to the queue