Google Groups

Re: How to deliver a response to a client after a Node.js server gets a message from a AMQP queue?

Cassio Melo May 1, 2012 1:29 AM
Posted in group: nodejs
Thanks mlegenhausen, that was exactly what I was looking for. It is a
RPC call indeed.


On Apr 30, 9:10 am, mlegenhausen <> wrote:
> One solution is to subscribe to the queue in your request handler:
> app.get('/test', loadUser, function(req, res) {
>    queue.subscribe(function(msg) {
>       // Unsubcribe here. Maybe there is something like a once listener?
>       res.send(;
>    });
>    exchange.publish('task_queue', 'functional!', {
>       replyTo: 'incoming'
>    });
> });
> Don't know exactly if this is the thing you want to do? Cause this looks
> more like a rpc request you want to make. Queues are more used for async
> tasks where the result is returns later on and then I would prefer to use
> for async response.