mxriverlynn / rabbus

A micro-service bus with built-in messaging patterns, for NodeJS and RabbitMQ
116 stars 26 forks source link

Question Regarding Receiving Messages #35

Open b3tts32 opened 7 years ago

b3tts32 commented 7 years ago

I'm going through your library and it's worked great going through the demos. I'm looking at a use case for receiving multiple messages.

The use case would be I would provide an api (express routes) that allows various applications to publish to and retrieve messages at their convenience. Publishing messages isn't an issue, but the questions come up on the receiving end. Ideally I'd provide the express endpoint and I'd receive all messages in the queue and use the body/array as the response. What I've seen is I can create a listener to get messages on demand, or consume and get messages one at a time. Would I need to loop through and get all the messages? Or is there a better method to retrieve all messages and return them from the queue?