You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Christian Posta <ch...@gmail.com> on 2013/07/01 16:35:23 UTC

Re: Regarding AMQ-4181 - JMS queue browser returns only page size number of messages

Take a look here and try to reproduce it:

https://fisheye6.atlassian.com/viewrep/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/QueueBrowsingTest.java?r=1411632




On Sun, Jun 30, 2013 at 1:14 AM, binita.bharati <bi...@gmail.com>wrote:

> Hi ,
>
> I downloaded ActiveMQ 5.8 from
> http://activemq.apache.org/activemq-580-release.html
> The https://issues.apache.org/jira/browse/AMQ-4181 says that this issue is
> fixed in 5.8 version, but, I still see the same problem happening.
>
> What could be wrong ?
>
> Thanks
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Regarding-AMQ-4181-JMS-queue-browser-returns-only-page-size-number-of-messages-tp4668724.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



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

Re: Regarding AMQ-4181 - JMS queue browser returns only page size number of messages

Posted by Christian Posta <ch...@gmail.com>.
The broker's main memory settings <memoryUsage> is used to indicate to the
broker how much space in the heap to use for messages. If you specify
destination memory limits, you indicate to the broker how much space to
*limit* this destination to....eg, default memoryUsage==64MB... if you
don't specify a limit, each destination can use part of the 64MB up to the
64MB limit... if you give a destination a limit, eg 1MB, then that
destination cannot use more than 1MB... you have to decide what values are
appropriate for your use case and how many messages should be kept in
memory.

In your case, the limit was set to 1MB, but you were expecting to page in >
2MB in messages to be browsed... so you were only able to see ~1MB worth of
messages


On Thu, Jul 4, 2013 at 1:24 PM, binita.bharati <bi...@gmail.com>wrote:

> Thanks !
> It was able to read all the 1000 messages after increasing the memory limit
> to 5mb. What are the implications of keeping a high memory limit please ? I
> mean, ideally, what should be the value for this parameter ?
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Regarding-AMQ-4181-JMS-queue-browser-returns-only-page-size-number-of-messages-tp4668724p4668885.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



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

Re: Regarding AMQ-4181 - JMS queue browser returns only page size number of messages

Posted by "binita.bharati" <bi...@gmail.com>.
Thanks !
It was able to read all the 1000 messages after increasing the memory limit
to 5mb. What are the implications of keeping a high memory limit please ? I
mean, ideally, what should be the value for this parameter ?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Regarding-AMQ-4181-JMS-queue-browser-returns-only-page-size-number-of-messages-tp4668724p4668885.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Regarding AMQ-4181 - JMS queue browser returns only page size number of messages

Posted by Christian Posta <ch...@gmail.com>.
Try increasing your memory limits for that destination. Instead of 1MB try 5


On Tue, Jul 2, 2013 at 11:25 PM, binita.bharati <bi...@gmail.com>wrote:

> Oh..
> It is the same test case that is failing for my version of external broker
> (ActiveMQ 5.8.0 installed on MAC OSX 10.8.3).
>
> I am getting the factory instance by plainly doing a :
> ActiveMQConnectionFactory  factory = new
> ActiveMQConnectionFactory("tcp://localhost:61616");
> No BrokerService related code is present in my test case. I just ran my
> testcase again, with higher number of messages (1000 messages sent) . The
> new test case link is  -
> http://pastebin.com/zNC1LLz8 <http://pastebin.com/zNC1LLz8>
> It again failed , here is the assertion error I got :
>
> java.lang.AssertionError:
> Expected :1000
> Actual   :239
>  <Click to see difference>
>         at org.junit.Assert.fail(Assert.java:92)
>         at org.junit.Assert.failNotEquals(Assert.java:689)
>         at org.junit.Assert.assertEquals(Assert.java:127)
>         at org.junit.Assert.assertEquals(Assert.java:514)
>         at org.junit.Assert.assertEquals(Assert.java:498)
>         at QueueBrowsingTest.testBrowsing(QueueBrowsingTest.java:56)
>
> I have this entry made into my activemq.xml conf file:
> <policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb"
> maxPageSize="9999" maxBrowsePageSize="9999">
> Had added the attributes maxPageSize and maxBrowsePageSize , after it was
> mentioned in some forum to try with these attributes set to some large
> number.
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Regarding-AMQ-4181-JMS-queue-browser-returns-only-page-size-number-of-messages-tp4668724p4668827.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



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

Re: Regarding AMQ-4181 - JMS queue browser returns only page size number of messages

Posted by "binita.bharati" <bi...@gmail.com>.
Oh.. 
It is the same test case that is failing for my version of external broker
(ActiveMQ 5.8.0 installed on MAC OSX 10.8.3). 

I am getting the factory instance by plainly doing a :
ActiveMQConnectionFactory  factory = new
ActiveMQConnectionFactory("tcp://localhost:61616");
No BrokerService related code is present in my test case. I just ran my
testcase again, with higher number of messages (1000 messages sent) . The
new test case link is  - 
http://pastebin.com/zNC1LLz8 <http://pastebin.com/zNC1LLz8>  
It again failed , here is the assertion error I got :

java.lang.AssertionError: 
Expected :1000
Actual   :239
 <Click to see difference>
	at org.junit.Assert.fail(Assert.java:92)
	at org.junit.Assert.failNotEquals(Assert.java:689)
	at org.junit.Assert.assertEquals(Assert.java:127)
	at org.junit.Assert.assertEquals(Assert.java:514)
	at org.junit.Assert.assertEquals(Assert.java:498)
	at QueueBrowsingTest.testBrowsing(QueueBrowsingTest.java:56)

I have this entry made into my activemq.xml conf file:
<policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb"
maxPageSize="9999" maxBrowsePageSize="9999">
Had added the attributes maxPageSize and maxBrowsePageSize , after it was
mentioned in some forum to try with these attributes set to some large
number.
	



--
View this message in context: http://activemq.2283324.n4.nabble.com/Regarding-AMQ-4181-JMS-queue-browser-returns-only-page-size-number-of-messages-tp4668724p4668827.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Regarding AMQ-4181 - JMS queue browser returns only page size number of messages

Posted by Christian Posta <ch...@gmail.com>.
so the test you linked to doesn't fail. looks like it's the same thing
that's in the unit tests, and passes. maybe you pasted the wrong stuff?


On Tue, Jul 2, 2013 at 1:15 PM, binita.bharati <bi...@gmail.com>wrote:

>  Will try to be more clear..
> - All the 500+ messages first get put into the queue.
> - From then on, no more messages are being put into this queue.
> - Now, a QueueBrowser tries to read all the messages from the queue.
> - The QueueBrowser only gets 239 messages.
> - I have an external broker running.
>
> I have written the failing TestCase. As I can see now, the, only difference
> between the TestCase that you had linked, and mine is the use of an
> external
> broker. In my case, an external broker is used. Also, noticed that, even
> ActiveMQ web console doesn't show all 500 messages.(The web console shows
> the "No of pending messages" as 500. But, on drilling down to the queue
> details, it definitely does not list 500 messages). Here is the link to the
> failing test -  http://pastebin.com/sNFxWTxD <http://pastebin.com/sNFxWTxD
> >
>
>
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Regarding-AMQ-4181-JMS-queue-browser-returns-only-page-size-number-of-messages-tp4668724p4668805.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



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

Re: Regarding AMQ-4181 - JMS queue browser returns only page size number of messages

Posted by Christian Posta <ch...@gmail.com>.
Cool. unit test is the clearest communication :)
Will take a look when i get a sec.


On Tue, Jul 2, 2013 at 1:15 PM, binita.bharati <bi...@gmail.com>wrote:

>  Will try to be more clear..
> - All the 500+ messages first get put into the queue.
> - From then on, no more messages are being put into this queue.
> - Now, a QueueBrowser tries to read all the messages from the queue.
> - The QueueBrowser only gets 239 messages.
> - I have an external broker running.
>
> I have written the failing TestCase. As I can see now, the, only difference
> between the TestCase that you had linked, and mine is the use of an
> external
> broker. In my case, an external broker is used. Also, noticed that, even
> ActiveMQ web console doesn't show all 500 messages.(The web console shows
> the "No of pending messages" as 500. But, on drilling down to the queue
> details, it definitely does not list 500 messages). Here is the link to the
> failing test -  http://pastebin.com/sNFxWTxD <http://pastebin.com/sNFxWTxD
> >
>
>
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Regarding-AMQ-4181-JMS-queue-browser-returns-only-page-size-number-of-messages-tp4668724p4668805.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



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

Re: Regarding AMQ-4181 - JMS queue browser returns only page size number of messages

Posted by "binita.bharati" <bi...@gmail.com>.
 Will try to be more clear..
- All the 500+ messages first get put into the queue. 
- From then on, no more messages are being put into this queue.
- Now, a QueueBrowser tries to read all the messages from the queue.
- The QueueBrowser only gets 239 messages.
- I have an external broker running.

I have written the failing TestCase. As I can see now, the, only difference
between the TestCase that you had linked, and mine is the use of an external
broker. In my case, an external broker is used. Also, noticed that, even
ActiveMQ web console doesn't show all 500 messages.(The web console shows
the "No of pending messages" as 500. But, on drilling down to the queue
details, it definitely does not list 500 messages). Here is the link to the
failing test -  http://pastebin.com/sNFxWTxD <http://pastebin.com/sNFxWTxD>  






--
View this message in context: http://activemq.2283324.n4.nabble.com/Regarding-AMQ-4181-JMS-queue-browser-returns-only-page-size-number-of-messages-tp4668724p4668805.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Regarding AMQ-4181 - JMS queue browser returns only page size number of messages

Posted by Christian Posta <ch...@gmail.com>.
note that browsing will only return a snapshot... it won't stream back
messages as more messages are sent to the queue.

eg... if you create the queue browser when there are 239 messages in the
queue at that point, it will return those... even if your client is adding
more after that point.


On Tue, Jul 2, 2013 at 12:17 PM, binita.bharati <bi...@gmail.com>wrote:

> The testcase has this significant difference in approach from what I am
> doing:
>  - TestCase uses the same javax.jms.Session instance to both produce and
> then browse the queue.
>
> What I am doing :
> - A queue is already present in the broker, and am sending messages to this
> queue (works fine, and shows up fine in ActiveMQ web console)
> - There are no consumers for this queue
> - Now , I need to browse this queue. So, I create a QueueBrowser instance
> (in a different javax.jms.Session), and try enumerating over it. The queue
> has over 500 messages, but the QueueBrowser only returns the first 239
> messages.
>
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Regarding-AMQ-4181-JMS-queue-browser-returns-only-page-size-number-of-messages-tp4668724p4668801.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



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

Re: Regarding AMQ-4181 - JMS queue browser returns only page size number of messages

Posted by "binita.bharati" <bi...@gmail.com>.
The testcase has this significant difference in approach from what I am
doing:
 - TestCase uses the same javax.jms.Session instance to both produce and
then browse the queue.

What I am doing :
- A queue is already present in the broker, and am sending messages to this
queue (works fine, and shows up fine in ActiveMQ web console)
- There are no consumers for this queue
- Now , I need to browse this queue. So, I create a QueueBrowser instance
(in a different javax.jms.Session), and try enumerating over it. The queue
has over 500 messages, but the QueueBrowser only returns the first 239
messages.





--
View this message in context: http://activemq.2283324.n4.nabble.com/Regarding-AMQ-4181-JMS-queue-browser-returns-only-page-size-number-of-messages-tp4668724p4668801.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.