You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Mohit Anchlia <mo...@gmail.com> on 2013/01/25 02:47:36 UTC

QueueBrowser not picking all the messages

I have around 1K messages in the queue. When I run my queue browser
"browser.getEnumeration();" gets only 270-300 messages at one time.

   connection = connectionFactory.createConnection();
   connection.start();
   session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
   Queue fq = session.createQueue(from);
   QueueBrowser browser = session.createBrowser(fq);
   // to
   toConnection = toConnectionFactory.createConnection();
   toConnection.start();
   toSession = toConnection.createSession(false,
     Session.AUTO_ACKNOWLEDGE);
   Queue tq = toSession.createQueue(to);
   toProducer = toSession.createProducer(tq);
   Enumeration<Message> e = browser.getEnumeration();
   Message message = null;
   TextMessage textMessage = null;
   String selector = null;
   int i = 0;
   while (e.hasMoreElements()) {
    log.info("Processing " + i);

    message = e.nextElement();
    // final String messageBody = ((TextMessage) message).getText();
    // textMessage = session.createTextMessage(messageBody);
    toProducer.send(message);
    log.info(message.getJMSMessageID());
    /*
     * // log.info("Message: " + messageBody); try { selector =
     * "JMSMessageID = '" + message.getJMSMessageID() + "'"; //
     * consumer = session.createConsumer(fq, selector); //
     * consumer.receive(); } finally { // consumer.close(); }
     */
    i++;
   }

Re: QueueBrowser not picking all the messages

Posted by Christian Posta <ch...@gmail.com>.
no, doesn't ring a bell, just keep in mind that the browser will return a
snapshot of what was in the queue at the time of the call, it does not keep
a running or streaming number of messages. eg, if you're writing 1000
messages into the queue, but your call browse.enumerate() after only 300
are in there, your browser will see 300.


On Mon, Jan 28, 2013 at 10:42 AM, Mohit Anchlia <mo...@gmail.com>wrote:

> Thanks for testing. Is there anything related to pre-fetch or some other
> property that might cause it to return no elements even though there are
> elements in the queue?
>
> On Mon, Jan 28, 2013 at 6:25 AM, Christian Posta
> <ch...@gmail.com>wrote:
>
> > Not sure. I just ran your test on trunk with 1000 messages and it picked
> it
> > up fine. I also added a test to JmsQueueBrowserTest unit test, have a
> look
> > here:
> >
> >
> >
> http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java?r1=1425875&r2=1439420&diff_format=h
> >
> >
> > On Fri, Jan 25, 2013 at 1:08 PM, Mohit Anchlia <mohitanchlia@gmail.com
> > >wrote:
> >
> > > Does anyone know why queue browser is only able to pick up first 300
> > > messages?
> > >
> > > When I use consumer it seems to work better but of course it also
> removes
> > > the messages.
> > >
> > > On Thu, Jan 24, 2013 at 5:47 PM, Mohit Anchlia <mohitanchlia@gmail.com
> > > >wrote:
> > >
> > > > I have around 1K messages in the queue. When I run my queue browser
> > > > "browser.getEnumeration();" gets only 270-300 messages at one time.
> > > >
> > > >    connection = connectionFactory.createConnection();
> > > >    connection.start();
> > > >    session = connection.createSession(false,
> Session.AUTO_ACKNOWLEDGE);
> > > >    Queue fq = session.createQueue(from);
> > > >    QueueBrowser browser = session.createBrowser(fq);
> > > >    // to
> > > >    toConnection = toConnectionFactory.createConnection();
> > > >    toConnection.start();
> > > >    toSession = toConnection.createSession(false,
> > > >      Session.AUTO_ACKNOWLEDGE);
> > > >    Queue tq = toSession.createQueue(to);
> > > >    toProducer = toSession.createProducer(tq);
> > > >    Enumeration<Message> e = browser.getEnumeration();
> > > >    Message message = null;
> > > >    TextMessage textMessage = null;
> > > >    String selector = null;
> > > >    int i = 0;
> > > >    while (e.hasMoreElements()) {
> > > >     log.info("Processing " + i);
> > > >
> > > >     message = e.nextElement();
> > > >     // final String messageBody = ((TextMessage) message).getText();
> > > >     // textMessage = session.createTextMessage(messageBody);
> > > >     toProducer.send(message);
> > > >     log.info(message.getJMSMessageID());
> > > >     /*
> > > >      * // log.info("Message: " + messageBody); try { selector =
> > > >      * "JMSMessageID = '" + message.getJMSMessageID() + "'"; //
> > > >      * consumer = session.createConsumer(fq, selector); //
> > > >      * consumer.receive(); } finally { // consumer.close(); }
> > > >      */
> > > >     i++;
> > > >    }
> > > >
> > >
> >
> >
> >
> > --
> > *Christian Posta*
> > http://www.christianposta.com/blog
> > twitter: @christianposta
> >
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: QueueBrowser not picking all the messages

Posted by Mohit Anchlia <mo...@gmail.com>.
Behaviour I am seeing is wierd:
1) I have 3 network of brokers
2) No consumers on one of the hosts just network of brokers
3) When messages pile up, network of brokers receive those messages only
some of them not all of them. It's between 100-1000
4) At this point no messages are being received by other brokers even
though there are other messages in the queue.
5) Then I attach a consumer, my own client manually and consume 1 messages.
As soon as I do that network of brokers again start to receive messages and
then after 100-1000 messages it stops again.

Is this expected?

On Mon, Jan 28, 2013 at 2:01 PM, Christian Posta
<ch...@gmail.com>wrote:

> The general downside is using up too much broker memory when there are no
> consumers for a particular queue (or slow consumers)
>
>
> On Mon, Jan 28, 2013 at 2:12 PM, Mohit Anchlia <mohitanchlia@gmail.com
> >wrote:
>
> > Is there a downside of increasing to a much higher value?
> >
> > On Mon, Jan 28, 2013 at 1:05 PM, Christian Posta
> > <ch...@gmail.com>wrote:
> >
> > > Can set the max page size using policy entries:
> > >
> > > http://activemq.apache.org/per-destination-policies.html
> > >
> > >
> > > On Mon, Jan 28, 2013 at 1:15 PM, Mohit Anchlia <mohitanchlia@gmail.com
> > > >wrote:
> > >
> > > > Thanks! It does look related. How can I verify the page size? And is
> > > there
> > > > a workaround?
> > > >
> > > > On Mon, Jan 28, 2013 at 12:10 PM, Gary Tully <ga...@gmail.com>
> > > wrote:
> > > >
> > > > > there was a recent fix
> > https://issues.apache.org/jira/browse/AMQ-4181
> > > > >
> > > > >
> > > > > On 28 January 2013 17:42, Mohit Anchlia <mo...@gmail.com>
> > > wrote:
> > > > >
> > > > > > Thanks for testing. Is there anything related to pre-fetch or
> some
> > > > other
> > > > > > property that might cause it to return no elements even though
> > there
> > > > are
> > > > > > elements in the queue?
> > > > > >
> > > > > > On Mon, Jan 28, 2013 at 6:25 AM, Christian Posta
> > > > > > <ch...@gmail.com>wrote:
> > > > > >
> > > > > > > Not sure. I just ran your test on trunk with 1000 messages and
> it
> > > > > picked
> > > > > > it
> > > > > > > up fine. I also added a test to JmsQueueBrowserTest unit test,
> > > have a
> > > > > > look
> > > > > > > here:
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java?r1=1425875&r2=1439420&diff_format=h
> > > > > > >
> > > > > > >
> > > > > > > On Fri, Jan 25, 2013 at 1:08 PM, Mohit Anchlia <
> > > > mohitanchlia@gmail.com
> > > > > > > >wrote:
> > > > > > >
> > > > > > > > Does anyone know why queue browser is only able to pick up
> > first
> > > > 300
> > > > > > > > messages?
> > > > > > > >
> > > > > > > > When I use consumer it seems to work better but of course it
> > also
> > > > > > removes
> > > > > > > > the messages.
> > > > > > > >
> > > > > > > > On Thu, Jan 24, 2013 at 5:47 PM, Mohit Anchlia <
> > > > > mohitanchlia@gmail.com
> > > > > > > > >wrote:
> > > > > > > >
> > > > > > > > > I have around 1K messages in the queue. When I run my queue
> > > > browser
> > > > > > > > > "browser.getEnumeration();" gets only 270-300 messages at
> one
> > > > time.
> > > > > > > > >
> > > > > > > > >    connection = connectionFactory.createConnection();
> > > > > > > > >    connection.start();
> > > > > > > > >    session = connection.createSession(false,
> > > > > > Session.AUTO_ACKNOWLEDGE);
> > > > > > > > >    Queue fq = session.createQueue(from);
> > > > > > > > >    QueueBrowser browser = session.createBrowser(fq);
> > > > > > > > >    // to
> > > > > > > > >    toConnection = toConnectionFactory.createConnection();
> > > > > > > > >    toConnection.start();
> > > > > > > > >    toSession = toConnection.createSession(false,
> > > > > > > > >      Session.AUTO_ACKNOWLEDGE);
> > > > > > > > >    Queue tq = toSession.createQueue(to);
> > > > > > > > >    toProducer = toSession.createProducer(tq);
> > > > > > > > >    Enumeration<Message> e = browser.getEnumeration();
> > > > > > > > >    Message message = null;
> > > > > > > > >    TextMessage textMessage = null;
> > > > > > > > >    String selector = null;
> > > > > > > > >    int i = 0;
> > > > > > > > >    while (e.hasMoreElements()) {
> > > > > > > > >     log.info("Processing " + i);
> > > > > > > > >
> > > > > > > > >     message = e.nextElement();
> > > > > > > > >     // final String messageBody = ((TextMessage)
> > > > > message).getText();
> > > > > > > > >     // textMessage =
> session.createTextMessage(messageBody);
> > > > > > > > >     toProducer.send(message);
> > > > > > > > >     log.info(message.getJMSMessageID());
> > > > > > > > >     /*
> > > > > > > > >      * // log.info("Message: " + messageBody); try {
> > selector
> > > =
> > > > > > > > >      * "JMSMessageID = '" + message.getJMSMessageID() +
> "'";
> > //
> > > > > > > > >      * consumer = session.createConsumer(fq, selector); //
> > > > > > > > >      * consumer.receive(); } finally { //
> consumer.close(); }
> > > > > > > > >      */
> > > > > > > > >     i++;
> > > > > > > > >    }
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > *Christian Posta*
> > > > > > > http://www.christianposta.com/blog
> > > > > > > twitter: @christianposta
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > http://redhat.com
> > > > > http://blog.garytully.com
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > *Christian Posta*
> > > http://www.christianposta.com/blog
> > > twitter: @christianposta
> > >
> >
>
>
>
> --
> *Christian Posta*
> http://www.christianposta.com/blog
> twitter: @christianposta
>

Re: QueueBrowser not picking all the messages

Posted by Christian Posta <ch...@gmail.com>.
The general downside is using up too much broker memory when there are no
consumers for a particular queue (or slow consumers)


On Mon, Jan 28, 2013 at 2:12 PM, Mohit Anchlia <mo...@gmail.com>wrote:

> Is there a downside of increasing to a much higher value?
>
> On Mon, Jan 28, 2013 at 1:05 PM, Christian Posta
> <ch...@gmail.com>wrote:
>
> > Can set the max page size using policy entries:
> >
> > http://activemq.apache.org/per-destination-policies.html
> >
> >
> > On Mon, Jan 28, 2013 at 1:15 PM, Mohit Anchlia <mohitanchlia@gmail.com
> > >wrote:
> >
> > > Thanks! It does look related. How can I verify the page size? And is
> > there
> > > a workaround?
> > >
> > > On Mon, Jan 28, 2013 at 12:10 PM, Gary Tully <ga...@gmail.com>
> > wrote:
> > >
> > > > there was a recent fix
> https://issues.apache.org/jira/browse/AMQ-4181
> > > >
> > > >
> > > > On 28 January 2013 17:42, Mohit Anchlia <mo...@gmail.com>
> > wrote:
> > > >
> > > > > Thanks for testing. Is there anything related to pre-fetch or some
> > > other
> > > > > property that might cause it to return no elements even though
> there
> > > are
> > > > > elements in the queue?
> > > > >
> > > > > On Mon, Jan 28, 2013 at 6:25 AM, Christian Posta
> > > > > <ch...@gmail.com>wrote:
> > > > >
> > > > > > Not sure. I just ran your test on trunk with 1000 messages and it
> > > > picked
> > > > > it
> > > > > > up fine. I also added a test to JmsQueueBrowserTest unit test,
> > have a
> > > > > look
> > > > > > here:
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java?r1=1425875&r2=1439420&diff_format=h
> > > > > >
> > > > > >
> > > > > > On Fri, Jan 25, 2013 at 1:08 PM, Mohit Anchlia <
> > > mohitanchlia@gmail.com
> > > > > > >wrote:
> > > > > >
> > > > > > > Does anyone know why queue browser is only able to pick up
> first
> > > 300
> > > > > > > messages?
> > > > > > >
> > > > > > > When I use consumer it seems to work better but of course it
> also
> > > > > removes
> > > > > > > the messages.
> > > > > > >
> > > > > > > On Thu, Jan 24, 2013 at 5:47 PM, Mohit Anchlia <
> > > > mohitanchlia@gmail.com
> > > > > > > >wrote:
> > > > > > >
> > > > > > > > I have around 1K messages in the queue. When I run my queue
> > > browser
> > > > > > > > "browser.getEnumeration();" gets only 270-300 messages at one
> > > time.
> > > > > > > >
> > > > > > > >    connection = connectionFactory.createConnection();
> > > > > > > >    connection.start();
> > > > > > > >    session = connection.createSession(false,
> > > > > Session.AUTO_ACKNOWLEDGE);
> > > > > > > >    Queue fq = session.createQueue(from);
> > > > > > > >    QueueBrowser browser = session.createBrowser(fq);
> > > > > > > >    // to
> > > > > > > >    toConnection = toConnectionFactory.createConnection();
> > > > > > > >    toConnection.start();
> > > > > > > >    toSession = toConnection.createSession(false,
> > > > > > > >      Session.AUTO_ACKNOWLEDGE);
> > > > > > > >    Queue tq = toSession.createQueue(to);
> > > > > > > >    toProducer = toSession.createProducer(tq);
> > > > > > > >    Enumeration<Message> e = browser.getEnumeration();
> > > > > > > >    Message message = null;
> > > > > > > >    TextMessage textMessage = null;
> > > > > > > >    String selector = null;
> > > > > > > >    int i = 0;
> > > > > > > >    while (e.hasMoreElements()) {
> > > > > > > >     log.info("Processing " + i);
> > > > > > > >
> > > > > > > >     message = e.nextElement();
> > > > > > > >     // final String messageBody = ((TextMessage)
> > > > message).getText();
> > > > > > > >     // textMessage = session.createTextMessage(messageBody);
> > > > > > > >     toProducer.send(message);
> > > > > > > >     log.info(message.getJMSMessageID());
> > > > > > > >     /*
> > > > > > > >      * // log.info("Message: " + messageBody); try {
> selector
> > =
> > > > > > > >      * "JMSMessageID = '" + message.getJMSMessageID() + "'";
> //
> > > > > > > >      * consumer = session.createConsumer(fq, selector); //
> > > > > > > >      * consumer.receive(); } finally { // consumer.close(); }
> > > > > > > >      */
> > > > > > > >     i++;
> > > > > > > >    }
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > *Christian Posta*
> > > > > > http://www.christianposta.com/blog
> > > > > > twitter: @christianposta
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > http://redhat.com
> > > > http://blog.garytully.com
> > > >
> > >
> >
> >
> >
> > --
> > *Christian Posta*
> > http://www.christianposta.com/blog
> > twitter: @christianposta
> >
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: QueueBrowser not picking all the messages

Posted by Mohit Anchlia <mo...@gmail.com>.
Is there a downside of increasing to a much higher value?

On Mon, Jan 28, 2013 at 1:05 PM, Christian Posta
<ch...@gmail.com>wrote:

> Can set the max page size using policy entries:
>
> http://activemq.apache.org/per-destination-policies.html
>
>
> On Mon, Jan 28, 2013 at 1:15 PM, Mohit Anchlia <mohitanchlia@gmail.com
> >wrote:
>
> > Thanks! It does look related. How can I verify the page size? And is
> there
> > a workaround?
> >
> > On Mon, Jan 28, 2013 at 12:10 PM, Gary Tully <ga...@gmail.com>
> wrote:
> >
> > > there was a recent fix https://issues.apache.org/jira/browse/AMQ-4181
> > >
> > >
> > > On 28 January 2013 17:42, Mohit Anchlia <mo...@gmail.com>
> wrote:
> > >
> > > > Thanks for testing. Is there anything related to pre-fetch or some
> > other
> > > > property that might cause it to return no elements even though there
> > are
> > > > elements in the queue?
> > > >
> > > > On Mon, Jan 28, 2013 at 6:25 AM, Christian Posta
> > > > <ch...@gmail.com>wrote:
> > > >
> > > > > Not sure. I just ran your test on trunk with 1000 messages and it
> > > picked
> > > > it
> > > > > up fine. I also added a test to JmsQueueBrowserTest unit test,
> have a
> > > > look
> > > > > here:
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java?r1=1425875&r2=1439420&diff_format=h
> > > > >
> > > > >
> > > > > On Fri, Jan 25, 2013 at 1:08 PM, Mohit Anchlia <
> > mohitanchlia@gmail.com
> > > > > >wrote:
> > > > >
> > > > > > Does anyone know why queue browser is only able to pick up first
> > 300
> > > > > > messages?
> > > > > >
> > > > > > When I use consumer it seems to work better but of course it also
> > > > removes
> > > > > > the messages.
> > > > > >
> > > > > > On Thu, Jan 24, 2013 at 5:47 PM, Mohit Anchlia <
> > > mohitanchlia@gmail.com
> > > > > > >wrote:
> > > > > >
> > > > > > > I have around 1K messages in the queue. When I run my queue
> > browser
> > > > > > > "browser.getEnumeration();" gets only 270-300 messages at one
> > time.
> > > > > > >
> > > > > > >    connection = connectionFactory.createConnection();
> > > > > > >    connection.start();
> > > > > > >    session = connection.createSession(false,
> > > > Session.AUTO_ACKNOWLEDGE);
> > > > > > >    Queue fq = session.createQueue(from);
> > > > > > >    QueueBrowser browser = session.createBrowser(fq);
> > > > > > >    // to
> > > > > > >    toConnection = toConnectionFactory.createConnection();
> > > > > > >    toConnection.start();
> > > > > > >    toSession = toConnection.createSession(false,
> > > > > > >      Session.AUTO_ACKNOWLEDGE);
> > > > > > >    Queue tq = toSession.createQueue(to);
> > > > > > >    toProducer = toSession.createProducer(tq);
> > > > > > >    Enumeration<Message> e = browser.getEnumeration();
> > > > > > >    Message message = null;
> > > > > > >    TextMessage textMessage = null;
> > > > > > >    String selector = null;
> > > > > > >    int i = 0;
> > > > > > >    while (e.hasMoreElements()) {
> > > > > > >     log.info("Processing " + i);
> > > > > > >
> > > > > > >     message = e.nextElement();
> > > > > > >     // final String messageBody = ((TextMessage)
> > > message).getText();
> > > > > > >     // textMessage = session.createTextMessage(messageBody);
> > > > > > >     toProducer.send(message);
> > > > > > >     log.info(message.getJMSMessageID());
> > > > > > >     /*
> > > > > > >      * // log.info("Message: " + messageBody); try { selector
> =
> > > > > > >      * "JMSMessageID = '" + message.getJMSMessageID() + "'"; //
> > > > > > >      * consumer = session.createConsumer(fq, selector); //
> > > > > > >      * consumer.receive(); } finally { // consumer.close(); }
> > > > > > >      */
> > > > > > >     i++;
> > > > > > >    }
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > *Christian Posta*
> > > > > http://www.christianposta.com/blog
> > > > > twitter: @christianposta
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > http://redhat.com
> > > http://blog.garytully.com
> > >
> >
>
>
>
> --
> *Christian Posta*
> http://www.christianposta.com/blog
> twitter: @christianposta
>

Re: QueueBrowser not picking all the messages

Posted by Christian Posta <ch...@gmail.com>.
Can set the max page size using policy entries:

http://activemq.apache.org/per-destination-policies.html


On Mon, Jan 28, 2013 at 1:15 PM, Mohit Anchlia <mo...@gmail.com>wrote:

> Thanks! It does look related. How can I verify the page size? And is there
> a workaround?
>
> On Mon, Jan 28, 2013 at 12:10 PM, Gary Tully <ga...@gmail.com> wrote:
>
> > there was a recent fix https://issues.apache.org/jira/browse/AMQ-4181
> >
> >
> > On 28 January 2013 17:42, Mohit Anchlia <mo...@gmail.com> wrote:
> >
> > > Thanks for testing. Is there anything related to pre-fetch or some
> other
> > > property that might cause it to return no elements even though there
> are
> > > elements in the queue?
> > >
> > > On Mon, Jan 28, 2013 at 6:25 AM, Christian Posta
> > > <ch...@gmail.com>wrote:
> > >
> > > > Not sure. I just ran your test on trunk with 1000 messages and it
> > picked
> > > it
> > > > up fine. I also added a test to JmsQueueBrowserTest unit test, have a
> > > look
> > > > here:
> > > >
> > > >
> > > >
> > >
> >
> http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java?r1=1425875&r2=1439420&diff_format=h
> > > >
> > > >
> > > > On Fri, Jan 25, 2013 at 1:08 PM, Mohit Anchlia <
> mohitanchlia@gmail.com
> > > > >wrote:
> > > >
> > > > > Does anyone know why queue browser is only able to pick up first
> 300
> > > > > messages?
> > > > >
> > > > > When I use consumer it seems to work better but of course it also
> > > removes
> > > > > the messages.
> > > > >
> > > > > On Thu, Jan 24, 2013 at 5:47 PM, Mohit Anchlia <
> > mohitanchlia@gmail.com
> > > > > >wrote:
> > > > >
> > > > > > I have around 1K messages in the queue. When I run my queue
> browser
> > > > > > "browser.getEnumeration();" gets only 270-300 messages at one
> time.
> > > > > >
> > > > > >    connection = connectionFactory.createConnection();
> > > > > >    connection.start();
> > > > > >    session = connection.createSession(false,
> > > Session.AUTO_ACKNOWLEDGE);
> > > > > >    Queue fq = session.createQueue(from);
> > > > > >    QueueBrowser browser = session.createBrowser(fq);
> > > > > >    // to
> > > > > >    toConnection = toConnectionFactory.createConnection();
> > > > > >    toConnection.start();
> > > > > >    toSession = toConnection.createSession(false,
> > > > > >      Session.AUTO_ACKNOWLEDGE);
> > > > > >    Queue tq = toSession.createQueue(to);
> > > > > >    toProducer = toSession.createProducer(tq);
> > > > > >    Enumeration<Message> e = browser.getEnumeration();
> > > > > >    Message message = null;
> > > > > >    TextMessage textMessage = null;
> > > > > >    String selector = null;
> > > > > >    int i = 0;
> > > > > >    while (e.hasMoreElements()) {
> > > > > >     log.info("Processing " + i);
> > > > > >
> > > > > >     message = e.nextElement();
> > > > > >     // final String messageBody = ((TextMessage)
> > message).getText();
> > > > > >     // textMessage = session.createTextMessage(messageBody);
> > > > > >     toProducer.send(message);
> > > > > >     log.info(message.getJMSMessageID());
> > > > > >     /*
> > > > > >      * // log.info("Message: " + messageBody); try { selector =
> > > > > >      * "JMSMessageID = '" + message.getJMSMessageID() + "'"; //
> > > > > >      * consumer = session.createConsumer(fq, selector); //
> > > > > >      * consumer.receive(); } finally { // consumer.close(); }
> > > > > >      */
> > > > > >     i++;
> > > > > >    }
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > *Christian Posta*
> > > > http://www.christianposta.com/blog
> > > > twitter: @christianposta
> > > >
> > >
> >
> >
> >
> > --
> > http://redhat.com
> > http://blog.garytully.com
> >
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: QueueBrowser not picking all the messages

Posted by Mohit Anchlia <mo...@gmail.com>.
Thanks! It does look related. How can I verify the page size? And is there
a workaround?

On Mon, Jan 28, 2013 at 12:10 PM, Gary Tully <ga...@gmail.com> wrote:

> there was a recent fix https://issues.apache.org/jira/browse/AMQ-4181
>
>
> On 28 January 2013 17:42, Mohit Anchlia <mo...@gmail.com> wrote:
>
> > Thanks for testing. Is there anything related to pre-fetch or some other
> > property that might cause it to return no elements even though there are
> > elements in the queue?
> >
> > On Mon, Jan 28, 2013 at 6:25 AM, Christian Posta
> > <ch...@gmail.com>wrote:
> >
> > > Not sure. I just ran your test on trunk with 1000 messages and it
> picked
> > it
> > > up fine. I also added a test to JmsQueueBrowserTest unit test, have a
> > look
> > > here:
> > >
> > >
> > >
> >
> http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java?r1=1425875&r2=1439420&diff_format=h
> > >
> > >
> > > On Fri, Jan 25, 2013 at 1:08 PM, Mohit Anchlia <mohitanchlia@gmail.com
> > > >wrote:
> > >
> > > > Does anyone know why queue browser is only able to pick up first 300
> > > > messages?
> > > >
> > > > When I use consumer it seems to work better but of course it also
> > removes
> > > > the messages.
> > > >
> > > > On Thu, Jan 24, 2013 at 5:47 PM, Mohit Anchlia <
> mohitanchlia@gmail.com
> > > > >wrote:
> > > >
> > > > > I have around 1K messages in the queue. When I run my queue browser
> > > > > "browser.getEnumeration();" gets only 270-300 messages at one time.
> > > > >
> > > > >    connection = connectionFactory.createConnection();
> > > > >    connection.start();
> > > > >    session = connection.createSession(false,
> > Session.AUTO_ACKNOWLEDGE);
> > > > >    Queue fq = session.createQueue(from);
> > > > >    QueueBrowser browser = session.createBrowser(fq);
> > > > >    // to
> > > > >    toConnection = toConnectionFactory.createConnection();
> > > > >    toConnection.start();
> > > > >    toSession = toConnection.createSession(false,
> > > > >      Session.AUTO_ACKNOWLEDGE);
> > > > >    Queue tq = toSession.createQueue(to);
> > > > >    toProducer = toSession.createProducer(tq);
> > > > >    Enumeration<Message> e = browser.getEnumeration();
> > > > >    Message message = null;
> > > > >    TextMessage textMessage = null;
> > > > >    String selector = null;
> > > > >    int i = 0;
> > > > >    while (e.hasMoreElements()) {
> > > > >     log.info("Processing " + i);
> > > > >
> > > > >     message = e.nextElement();
> > > > >     // final String messageBody = ((TextMessage)
> message).getText();
> > > > >     // textMessage = session.createTextMessage(messageBody);
> > > > >     toProducer.send(message);
> > > > >     log.info(message.getJMSMessageID());
> > > > >     /*
> > > > >      * // log.info("Message: " + messageBody); try { selector =
> > > > >      * "JMSMessageID = '" + message.getJMSMessageID() + "'"; //
> > > > >      * consumer = session.createConsumer(fq, selector); //
> > > > >      * consumer.receive(); } finally { // consumer.close(); }
> > > > >      */
> > > > >     i++;
> > > > >    }
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > *Christian Posta*
> > > http://www.christianposta.com/blog
> > > twitter: @christianposta
> > >
> >
>
>
>
> --
> http://redhat.com
> http://blog.garytully.com
>

Re: QueueBrowser not picking all the messages

Posted by Gary Tully <ga...@gmail.com>.
there was a recent fix https://issues.apache.org/jira/browse/AMQ-4181


On 28 January 2013 17:42, Mohit Anchlia <mo...@gmail.com> wrote:

> Thanks for testing. Is there anything related to pre-fetch or some other
> property that might cause it to return no elements even though there are
> elements in the queue?
>
> On Mon, Jan 28, 2013 at 6:25 AM, Christian Posta
> <ch...@gmail.com>wrote:
>
> > Not sure. I just ran your test on trunk with 1000 messages and it picked
> it
> > up fine. I also added a test to JmsQueueBrowserTest unit test, have a
> look
> > here:
> >
> >
> >
> http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java?r1=1425875&r2=1439420&diff_format=h
> >
> >
> > On Fri, Jan 25, 2013 at 1:08 PM, Mohit Anchlia <mohitanchlia@gmail.com
> > >wrote:
> >
> > > Does anyone know why queue browser is only able to pick up first 300
> > > messages?
> > >
> > > When I use consumer it seems to work better but of course it also
> removes
> > > the messages.
> > >
> > > On Thu, Jan 24, 2013 at 5:47 PM, Mohit Anchlia <mohitanchlia@gmail.com
> > > >wrote:
> > >
> > > > I have around 1K messages in the queue. When I run my queue browser
> > > > "browser.getEnumeration();" gets only 270-300 messages at one time.
> > > >
> > > >    connection = connectionFactory.createConnection();
> > > >    connection.start();
> > > >    session = connection.createSession(false,
> Session.AUTO_ACKNOWLEDGE);
> > > >    Queue fq = session.createQueue(from);
> > > >    QueueBrowser browser = session.createBrowser(fq);
> > > >    // to
> > > >    toConnection = toConnectionFactory.createConnection();
> > > >    toConnection.start();
> > > >    toSession = toConnection.createSession(false,
> > > >      Session.AUTO_ACKNOWLEDGE);
> > > >    Queue tq = toSession.createQueue(to);
> > > >    toProducer = toSession.createProducer(tq);
> > > >    Enumeration<Message> e = browser.getEnumeration();
> > > >    Message message = null;
> > > >    TextMessage textMessage = null;
> > > >    String selector = null;
> > > >    int i = 0;
> > > >    while (e.hasMoreElements()) {
> > > >     log.info("Processing " + i);
> > > >
> > > >     message = e.nextElement();
> > > >     // final String messageBody = ((TextMessage) message).getText();
> > > >     // textMessage = session.createTextMessage(messageBody);
> > > >     toProducer.send(message);
> > > >     log.info(message.getJMSMessageID());
> > > >     /*
> > > >      * // log.info("Message: " + messageBody); try { selector =
> > > >      * "JMSMessageID = '" + message.getJMSMessageID() + "'"; //
> > > >      * consumer = session.createConsumer(fq, selector); //
> > > >      * consumer.receive(); } finally { // consumer.close(); }
> > > >      */
> > > >     i++;
> > > >    }
> > > >
> > >
> >
> >
> >
> > --
> > *Christian Posta*
> > http://www.christianposta.com/blog
> > twitter: @christianposta
> >
>



-- 
http://redhat.com
http://blog.garytully.com

Re: QueueBrowser not picking all the messages

Posted by Mohit Anchlia <mo...@gmail.com>.
Thanks for testing. Is there anything related to pre-fetch or some other
property that might cause it to return no elements even though there are
elements in the queue?

On Mon, Jan 28, 2013 at 6:25 AM, Christian Posta
<ch...@gmail.com>wrote:

> Not sure. I just ran your test on trunk with 1000 messages and it picked it
> up fine. I also added a test to JmsQueueBrowserTest unit test, have a look
> here:
>
>
> http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java?r1=1425875&r2=1439420&diff_format=h
>
>
> On Fri, Jan 25, 2013 at 1:08 PM, Mohit Anchlia <mohitanchlia@gmail.com
> >wrote:
>
> > Does anyone know why queue browser is only able to pick up first 300
> > messages?
> >
> > When I use consumer it seems to work better but of course it also removes
> > the messages.
> >
> > On Thu, Jan 24, 2013 at 5:47 PM, Mohit Anchlia <mohitanchlia@gmail.com
> > >wrote:
> >
> > > I have around 1K messages in the queue. When I run my queue browser
> > > "browser.getEnumeration();" gets only 270-300 messages at one time.
> > >
> > >    connection = connectionFactory.createConnection();
> > >    connection.start();
> > >    session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
> > >    Queue fq = session.createQueue(from);
> > >    QueueBrowser browser = session.createBrowser(fq);
> > >    // to
> > >    toConnection = toConnectionFactory.createConnection();
> > >    toConnection.start();
> > >    toSession = toConnection.createSession(false,
> > >      Session.AUTO_ACKNOWLEDGE);
> > >    Queue tq = toSession.createQueue(to);
> > >    toProducer = toSession.createProducer(tq);
> > >    Enumeration<Message> e = browser.getEnumeration();
> > >    Message message = null;
> > >    TextMessage textMessage = null;
> > >    String selector = null;
> > >    int i = 0;
> > >    while (e.hasMoreElements()) {
> > >     log.info("Processing " + i);
> > >
> > >     message = e.nextElement();
> > >     // final String messageBody = ((TextMessage) message).getText();
> > >     // textMessage = session.createTextMessage(messageBody);
> > >     toProducer.send(message);
> > >     log.info(message.getJMSMessageID());
> > >     /*
> > >      * // log.info("Message: " + messageBody); try { selector =
> > >      * "JMSMessageID = '" + message.getJMSMessageID() + "'"; //
> > >      * consumer = session.createConsumer(fq, selector); //
> > >      * consumer.receive(); } finally { // consumer.close(); }
> > >      */
> > >     i++;
> > >    }
> > >
> >
>
>
>
> --
> *Christian Posta*
> http://www.christianposta.com/blog
> twitter: @christianposta
>

Re: QueueBrowser not picking all the messages

Posted by Christian Posta <ch...@gmail.com>.
Not sure. I just ran your test on trunk with 1000 messages and it picked it
up fine. I also added a test to JmsQueueBrowserTest unit test, have a look
here:

http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java?r1=1425875&r2=1439420&diff_format=h


On Fri, Jan 25, 2013 at 1:08 PM, Mohit Anchlia <mo...@gmail.com>wrote:

> Does anyone know why queue browser is only able to pick up first 300
> messages?
>
> When I use consumer it seems to work better but of course it also removes
> the messages.
>
> On Thu, Jan 24, 2013 at 5:47 PM, Mohit Anchlia <mohitanchlia@gmail.com
> >wrote:
>
> > I have around 1K messages in the queue. When I run my queue browser
> > "browser.getEnumeration();" gets only 270-300 messages at one time.
> >
> >    connection = connectionFactory.createConnection();
> >    connection.start();
> >    session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
> >    Queue fq = session.createQueue(from);
> >    QueueBrowser browser = session.createBrowser(fq);
> >    // to
> >    toConnection = toConnectionFactory.createConnection();
> >    toConnection.start();
> >    toSession = toConnection.createSession(false,
> >      Session.AUTO_ACKNOWLEDGE);
> >    Queue tq = toSession.createQueue(to);
> >    toProducer = toSession.createProducer(tq);
> >    Enumeration<Message> e = browser.getEnumeration();
> >    Message message = null;
> >    TextMessage textMessage = null;
> >    String selector = null;
> >    int i = 0;
> >    while (e.hasMoreElements()) {
> >     log.info("Processing " + i);
> >
> >     message = e.nextElement();
> >     // final String messageBody = ((TextMessage) message).getText();
> >     // textMessage = session.createTextMessage(messageBody);
> >     toProducer.send(message);
> >     log.info(message.getJMSMessageID());
> >     /*
> >      * // log.info("Message: " + messageBody); try { selector =
> >      * "JMSMessageID = '" + message.getJMSMessageID() + "'"; //
> >      * consumer = session.createConsumer(fq, selector); //
> >      * consumer.receive(); } finally { // consumer.close(); }
> >      */
> >     i++;
> >    }
> >
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: QueueBrowser not picking all the messages

Posted by Mohit Anchlia <mo...@gmail.com>.
Does anyone know why queue browser is only able to pick up first 300
messages?

When I use consumer it seems to work better but of course it also removes
the messages.

On Thu, Jan 24, 2013 at 5:47 PM, Mohit Anchlia <mo...@gmail.com>wrote:

> I have around 1K messages in the queue. When I run my queue browser
> "browser.getEnumeration();" gets only 270-300 messages at one time.
>
>    connection = connectionFactory.createConnection();
>    connection.start();
>    session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
>    Queue fq = session.createQueue(from);
>    QueueBrowser browser = session.createBrowser(fq);
>    // to
>    toConnection = toConnectionFactory.createConnection();
>    toConnection.start();
>    toSession = toConnection.createSession(false,
>      Session.AUTO_ACKNOWLEDGE);
>    Queue tq = toSession.createQueue(to);
>    toProducer = toSession.createProducer(tq);
>    Enumeration<Message> e = browser.getEnumeration();
>    Message message = null;
>    TextMessage textMessage = null;
>    String selector = null;
>    int i = 0;
>    while (e.hasMoreElements()) {
>     log.info("Processing " + i);
>
>     message = e.nextElement();
>     // final String messageBody = ((TextMessage) message).getText();
>     // textMessage = session.createTextMessage(messageBody);
>     toProducer.send(message);
>     log.info(message.getJMSMessageID());
>     /*
>      * // log.info("Message: " + messageBody); try { selector =
>      * "JMSMessageID = '" + message.getJMSMessageID() + "'"; //
>      * consumer = session.createConsumer(fq, selector); //
>      * consumer.receive(); } finally { // consumer.close(); }
>      */
>     i++;
>    }
>