You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Kim Garcia <js...@hotmail.com> on 2011/03/07 18:55:33 UTC

getEnumeration() creates new connections/consumers

Hello,
 
I have a static ring queue which I am polling for messages. I created a QueueBrowser object and use it to call getEnumeration() to get all of the messages on the queue. This is in a while loop and I have it sleep for a short while in between iterations. Also I am using MRG 1.3.
 
While this was running I didn't notice anything unusual in my application, but when I log onto the MRG server and monitor the queue size, rate the messages are enqueued/dequeued, ect, I noticed that the number of consumers was increasing. I put a print statement every time getEnumeration() is called and included a counter. I ran my app again and saw that as my getEnumeration() statement printed out and the counter increased, the numbers of consumers increased and the numbers matched. 
 
As a work around, I close the QueueBrowser and recreate it every time I want to call getEnumeration(). Has anyone else seen this happen?
 
Thank you. 		 	   		  

RE: getEnumeration() creates new connections/consumers

Posted by Kim Garcia <js...@hotmail.com>.
PS. I am using Java 1.6
 
> From: jsmam97@hotmail.com
> To: users@qpid.apache.org
> Subject: getEnumeration() creates new connections/consumers
> Date: Mon, 7 Mar 2011 11:55:33 -0600
> 
> 
> Hello,
> 
> I have a static ring queue which I am polling for messages. I created a QueueBrowser object and use it to call getEnumeration() to get all of the messages on the queue. This is in a while loop and I have it sleep for a short while in between iterations. Also I am using MRG 1.3.
> 
> While this was running I didn't notice anything unusual in my application, but when I log onto the MRG server and monitor the queue size, rate the messages are enqueued/dequeued, ect, I noticed that the number of consumers was increasing. I put a print statement every time getEnumeration() is called and included a counter. I ran my app again and saw that as my getEnumeration() statement printed out and the counter increased, the numbers of consumers increased and the numbers matched. 
> 
> As a work around, I close the QueueBrowser and recreate it every time I want to call getEnumeration(). Has anyone else seen this happen?
> 
> Thank you. 
 		 	   		  

Re: getEnumeration() creates new connections/consumers

Posted by Rajith Attapattu <ra...@gmail.com>.
I will be investigating this tomorrow and will get back to you with the
details.

Rajith

On Mon, Mar 7, 2011 at 12:55 PM, Kim Garcia <js...@hotmail.com> wrote:

>
> Hello,
>
> I have a static ring queue which I am polling for messages. I created a
> QueueBrowser object and use it to call getEnumeration() to get all of the
> messages on the queue. This is in a while loop and I have it sleep for a
> short while in between iterations. Also I am using MRG 1.3.
>
> While this was running I didn't notice anything unusual in my application,
> but when I log onto the MRG server and monitor the queue size, rate the
> messages are enqueued/dequeued, ect, I noticed that the number of consumers
> was increasing. I put a print statement every time getEnumeration() is
> called and included a counter. I ran my app again and saw that as my
> getEnumeration() statement printed out and the counter increased, the
> numbers of consumers increased and the numbers matched.
>
> As a work around, I close the QueueBrowser and recreate it every time I
> want to call getEnumeration(). Has anyone else seen this happen?
>
> Thank you.

Re: getEnumeration() creates new connections/consumers

Posted by Rajith Attapattu <ra...@gmail.com>.
Hi Kim,

I had a quick look at the code and I see that we do create a consumer each
time getEnumeration is called.
I do find it a bit odd and will investigate further as to why it was done
this particular way.

Regards,

Rajith

On Mon, Mar 7, 2011 at 12:55 PM, Kim Garcia <js...@hotmail.com> wrote:

>
> Hello,
>
> I have a static ring queue which I am polling for messages. I created a
> QueueBrowser object and use it to call getEnumeration() to get all of the
> messages on the queue. This is in a while loop and I have it sleep for a
> short while in between iterations. Also I am using MRG 1.3.
>
> While this was running I didn't notice anything unusual in my application,
> but when I log onto the MRG server and monitor the queue size, rate the
> messages are enqueued/dequeued, ect, I noticed that the number of consumers
> was increasing. I put a print statement every time getEnumeration() is
> called and included a counter. I ran my app again and saw that as my
> getEnumeration() statement printed out and the counter increased, the
> numbers of consumers increased and the numbers matched.
>
> As a work around, I close the QueueBrowser and recreate it every time I
> want to call getEnumeration(). Has anyone else seen this happen?
>
> Thank you.

Re: getEnumeration() creates new connections/consumers

Posted by Rajith Attapattu <ra...@gmail.com>.
Kim,

I am trying to understand your use case a bit more in detail.
Perhaps the QueueBrowser may not be the optimal solution here.

(a) Are you only interested in just the new messages coming into the ring
queue ? i.e get notified about updates in a non-consuming manner ?
(b) Or do you need to look at the entire queue each time you invoke
getEnumeration() ?

If it's (a) then you can create a regular consumer using the addressing
syntax and use browse mode. Further you could use a message listener to
receive updates asynchronously as well.
Here is an example address string that does the above.

"my-ring-queue; {mode: browse}"  - where my-ring-queue is a ring queue that
already exists when you start the consumer.

Does that help ?

Regards,

Rajith

On Mon, Mar 7, 2011 at 12:55 PM, Kim Garcia <js...@hotmail.com> wrote:

>
> Hello,
>
> I have a static ring queue which I am polling for messages. I created a
> QueueBrowser object and use it to call getEnumeration() to get all of the
> messages on the queue. This is in a while loop and I have it sleep for a
> short while in between iterations. Also I am using MRG 1.3.
>
> While this was running I didn't notice anything unusual in my application,
> but when I log onto the MRG server and monitor the queue size, rate the
> messages are enqueued/dequeued, ect, I noticed that the number of consumers
> was increasing. I put a print statement every time getEnumeration() is
> called and included a counter. I ran my app again and saw that as my
> getEnumeration() statement printed out and the counter increased, the
> numbers of consumers increased and the numbers matched.
>
> As a work around, I close the QueueBrowser and recreate it every time I
> want to call getEnumeration(). Has anyone else seen this happen?
>
> Thank you.