From pathsny at gmail.com Tue Feb 2 13:40:31 2010 From: pathsny at gmail.com (vishnu) Date: Wed, 3 Feb 2010 00:10:31 +0530 Subject: [bunny-amqp-devel] subscribing to multiple queues Message-ID: Hi Chris in our system we have a bunch of different messages that flow through the system. We were considering using several different queues for each different kind of message (so we can monitor the system easier), but signing up all consumers to subscribe to every queue so that we could automatically make sure we handle all messages efficiently. Is this possible with bunny? thanks Vishnu -------------- next part -------------- An HTML attachment was scrubbed... URL: From celldee at gmail.com Wed Feb 3 13:54:57 2010 From: celldee at gmail.com (celldee) Date: Wed, 3 Feb 2010 10:54:57 -0800 (PST) Subject: [bunny-amqp-devel] dectecting a client timeout with bunny In-Reply-To: References: Message-ID: <8016a169-bca5-47d3-8b8b-982aa8814ef2@a5g2000yqi.googlegroups.com> Hi Vishnu, On Jan 20, 4:04?pm, vishnu wrote: > Hi > ? ?Im attempting to use bunny to do the "rpc" mode communication where I > listen on a temporary queue for 1 message with a timeout. Is there a way for > me to detect after this step if the queue recieved a message or timedout > (other than by maintaining state myself?). It would be possible for me to do > this ofcourse, but I was wondering if the queue itself exposes this > information in some way? > > thanks > Vishnu > You can get a message count from the queue with the Queue#message_count method. Is that what you mean? Regards, Chris From celldee at gmail.com Wed Feb 3 14:11:50 2010 From: celldee at gmail.com (celldee) Date: Wed, 3 Feb 2010 11:11:50 -0800 (PST) Subject: [bunny-amqp-devel] subscribing to multiple queues In-Reply-To: References: Message-ID: Hi Vishnu, On Feb 2, 6:40?pm, vishnu wrote: > Hi Chris > ? ? in our system we have a bunch of different messages that flow through > the system. We were considering using several different queues for each > different kind of message (so we can monitor the system easier), but signing > up all consumers to subscribe to every queue so that we could automatically > make sure we handle all messages efficiently. Is this possible with bunny? > > thanks > Vishnu > I think that for one consumer to subscribe to many queues using bunny you would have to employ some kind of multi-threaded processing model. Each thread could use its own channel and reuse a single connection, but I don't know what this would actually look like in code (assuming that it could be written). Like I've said before, I have played a little with bunny and threads, but I much prefer the idea of a number of simple consumers rather than one complex one. Regards, Chris From pathsny at gmail.com Wed Feb 3 15:01:15 2010 From: pathsny at gmail.com (vishnu) Date: Thu, 4 Feb 2010 01:31:15 +0530 Subject: [bunny-amqp-devel] subscribing to multiple queues In-Reply-To: References: Message-ID: Hi Chris oh I didnt mean in a multi-threaded model. It looks like the java client allows you to subscribe to multiple queues in a single thread. It seems to work because a subscription is on a channel, not a queue. So it always gets one message from any of the queues it subscribes on and does not see the next message unless it deals with that one. (with prefetch 1) On Thu, Feb 4, 2010 at 12:41 AM, celldee wrote: > Hi Vishnu, > > On Feb 2, 6:40 pm, vishnu wrote: > > Hi Chris > > in our system we have a bunch of different messages that flow through > > the system. We were considering using several different queues for each > > different kind of message (so we can monitor the system easier), but > signing > > up all consumers to subscribe to every queue so that we could > automatically > > make sure we handle all messages efficiently. Is this possible with > bunny? > > > > thanks > > Vishnu > > > > I think that for one consumer to subscribe to many queues using bunny > you would have to employ some kind of multi-threaded processing model. > Each thread could use its own channel and reuse a single connection, > but I don't know what this would actually look like in code (assuming > that it could be written). Like I've said before, I have played a > little with bunny and threads, but I much prefer the idea of a number > of simple consumers rather than one complex one. > > Regards, > > Chris > _______________________________________________ > bunny-amqp-devel mailing list > bunny-amqp-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/bunny-amqp-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From celldee at gmail.com Wed Feb 3 17:54:01 2010 From: celldee at gmail.com (Chris Duncan) Date: Wed, 3 Feb 2010 22:54:01 +0000 Subject: [bunny-amqp-devel] subscribing to multiple queues In-Reply-To: References: Message-ID: <540277DB-57BE-48C0-AD86-D1F7E3AB7C93@gmail.com> Hi Vishnu, On 3 Feb 2010, at 20:01, vishnu wrote: > Hi Chris > oh I didnt mean in a multi-threaded model. It looks like the > java client allows you to subscribe to multiple queues in a single > thread. It seems to work because a subscription is on a channel, > not a queue. So it always gets one message from any of the queues > it subscribes on and does not see the next message unless it deals > with that one. (with prefetch 1) Bunny is a simple beast. When you subscribe it starts an infinite loop with a blocking read in it, so I can't think of a way to do what you want unless you use a thread per channel. I've not looked at the Java client in detail, but I suspect that multiple threads would be needed to do what you describe it doing. Regards, Chris From pathsny at gmail.com Sun Feb 7 06:39:08 2010 From: pathsny at gmail.com (vishnu) Date: Sun, 7 Feb 2010 17:09:08 +0530 Subject: [bunny-amqp-devel] using bunny to get check if a queue exists Message-ID: Hi Chris digging around in the bunny.queue method, it seems it allows me to say bunny.queue("name", :passive => true) to check if a queue exists. However, if I do this, I get a Qrack::ForcedChannelCloseError which makes it sound like the connection has now shut down. Is that right? thanks Vishnu -------------- next part -------------- An HTML attachment was scrubbed... URL: From pathsny at gmail.com Sun Feb 7 06:39:55 2010 From: pathsny at gmail.com (vishnu) Date: Sun, 7 Feb 2010 17:09:55 +0530 Subject: [bunny-amqp-devel] Fwd: subscribing to multiple queues In-Reply-To: References: <540277DB-57BE-48C0-AD86-D1F7E3AB7C93@gmail.com> Message-ID: hi Chris ah I see your point. It looks like you would need atleast 2 threads. One to allow people to add subscriptions to multiple queues and one to block on the channel waiting for any message and then matching it with the known subscriptions? How about 2 ways of subscribing to a queue? One which exits immedeatly but allows you to start doing the blocking read after setting all subscriptions? That would allow it to be single threaded. Something like queue1.subscribe(:start_now => false) {|msg| puts "message from queue 1 #{msg}"} queue2.subscribe(:start_now => false){|msg| puts "message from queue 2 #{msg}"} queue3.subscribe(:start_now => false){|msg| puts "message from queue 3 #{msg}"} bunny.start_subscriptions The main reason I like this is, if I have one subscriber type per queue, this requires a little more work in terms of scaling up by adding x of subscriber 1 and y of subscriber 2. But the only way to avoid that is to put all messages in one queue and have the subscriber differentiate between messages based on content or header information. Ofcourse the api I suggested might be a bit ugly =p On Thu, Feb 4, 2010 at 4:24 AM, Chris Duncan wrote: > Hi Vishnu, > > > On 3 Feb 2010, at 20:01, vishnu wrote: > > Hi Chris >> oh I didnt mean in a multi-threaded model. It looks like the java >> client allows you to subscribe to multiple queues in a single thread. It >> seems to work because a subscription is on a channel, not a queue. So it >> always gets one message from any of the queues it subscribes on and does not >> see the next message unless it deals with that one. (with prefetch 1) >> > > Bunny is a simple beast. When you subscribe it starts an infinite loop with > a blocking read in it, so I can't think of a way to do what you want unless > you use a thread per channel. I've not looked at the Java client in detail, > but I suspect that multiple threads would be needed to do what you describe > it doing. > > Regards, > > Chris > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From celldee at gmail.com Thu Feb 25 16:26:51 2010 From: celldee at gmail.com (celldee) Date: Thu, 25 Feb 2010 13:26:51 -0800 (PST) Subject: [bunny-amqp-devel] using bunny to get check if a queue exists In-Reply-To: References: Message-ID: Hi Vishnu, Unfortunately, you have to specify :type in the bunny.queue call. So you would have something like - bunny.queue("name", :passive => true, :type => :fanout) That's how RabbitMQ has been implemented. Not sure about the other servers. Regards, Chris On Feb 7, 11:39?am, vishnu wrote: > Hi Chris > ? ?digging around in the bunny.queue method, it seems it allows me to say > bunny.queue("name", :passive => true) to check if a queue exists. However, > if I do this, I get a Qrack::ForcedChannelCloseError which makes it sound > like the connection has now shut down. Is that right? > > thanks > Vishnu > > _______________________________________________ > bunny-amqp-devel mailing list > bunny-amqp-de... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/bunny-amqp-devel