Hi Dan, by "request" I mean "exchange", sorry. I know the queue has to
be configured each time. Let me rephrase the problem.

In the exchange above, the result is redirected to the queue
"incoming", which just prints out the message.

If I publish in the exchange for the second time, i.e,
"exchange.publish('msg_queue'... )", the queue "incoming" seems to be
not instantiated and throws this error:

Error: NOT_FOUND - no queue 'incoming' in vhost '/'
at Queue._onMethod (/Users/cassiomelo/code/cubix/cubix_nodejs/
node_modules/amqp/amqp.js

So, the question is, is it really necessary to instantiate the queue,
ie  queue = connection.queue('incoming',...) before publishing in the
exchange again?



On May 16, 7:04 pm, Dan Milon <[email protected]> wrote:
> What do you mean "request"? Incoming HTTP request?
> Why would you connect to the queue again and again every time?
>
> About the connection.queue, yes you have to provide the configuration
> each time. I think it is the way amqp is defined, and not node-amqp issue.
>
> On 05/16/2012 06:06 PM, Cassio Melo wrote:
>
>
>
>
>
>
>
> > Do I really need to instantiate the queue "queue =
> > connection.queue(...)" every time I want to use it?
>
> > Server (node.js):
>
> >   queue = connection.queue('incoming', { //<--- DO I REALLY NEED THAT
> > FOR EVERY REQUEST?
> >          durable : true,
> >          exclusive : false }, function() {});
>
> >   queue.subscribe(function(msg) {
> >        // Unsubcribe here. Maybe there is something like a once
> > listener?
> >       console.log("RECEIVED: "+msg)
> >        //res.send(msg.data);
> >        queue.unsubscribe(ctag);
> >       res.redirect('/home');
>
> >     }).addCallback(function(ok) { ctag = ok.consumerTag; });
>
> >     exchange.publish('msg_queue', 'functional!', {  // request
> >        replyTo: 'incoming'
> >     });
>
> > If queue = connection.queue(...); is instantiated with the server, the
> > first request using the queue is successful, but the following
> > requests throw an error:
>
> > Error: NOT_FOUND - no queue 'incoming' in vhost '/'
> > at Queue._onMethod (/Users/cassiomelo/code/cubix/cubix_nodejs/
> > node_modules/amqp/amqp.js

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to