You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by lixucheng <li...@cn.ibm.com> on 2014/06/23 13:31:21 UTC

How to turn off pre-fetched when browse LVQ

When I use JMS to browse my LVQ, why the queue attribute "Pre-fetched:"  is
always increase, for example: when I browse 5 messages, the pre-fetched will
be 5 msgs, when I browse the 5 messages again, the pre-fetched will increase
to 10 msgs. Dose anyone know how to turn off the pre-fetched, or set to a
fix value, do not increase always? Thanks.



--
View this message in context: http://qpid.2158936.n2.nabble.com/How-to-turn-off-pre-fetched-when-browse-LVQ-tp7609553.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: How to turn off pre-fetched when browse LVQ

Posted by lixucheng <li...@cn.ibm.com>.
Hi Oleksandr,

I have tried to add maxprefetch='1' property on the connection URL, and
browse the LVQ, but the "Pre-fetched:" attribute in LVQ also increased. As
below screen shot from Qpid web console.

1) I do not browse the queue.


2) I browse the queue once.


3) I browse the queue twice.


Below is my JMS client code, Could you please help to check whether I also
need to add some codes to avoid the pre-fetched increasing. Thanks.

import java.util.Enumeration;

import javax.jms.Connection;
import javax.jms.MapMessage;
import javax.jms.Queue;
import javax.jms.QueueBrowser;
import javax.jms.Session;

import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQQueue;



Connection connection = new AMQConnection(
"amqp://guest:guest@/?maxprefetch='1'&brokerlist='tcp://localhost:5672'");
connection.start();

Session session = connection.createSession(true, Session.SESSION_TRANSACTED
);
Queue queue = new AMQQueue("ADDR:my_queue");
QueueBrowser browser = session.createBrowser(queue);

Enumeration<?> enumeration = browser.getEnumeration();
while (enumeration.hasMoreElements()) {
	MapMessage map = (MapMessage) enumeration.nextElement();
	System.out.println(map);
}
session.commit();
connection.close();

Best Regards,

Li Xu Cheng



From:	"Oleksandr Rudyy [via Qpid]" <ml-node
            +s2158936n7609589h48@n2.nabble.com>
To:	Xu Cheng Li/China/IBM@IBMCN,
Date:	2014/06/24 18:23
Subject:	Re: How to turn off pre-fetched when browse LVQ



Hi,

The maximum prefetch value is set to 500 by default in Qpid JMS client for
AMQP 0.10 and 0.8/0.9.x protocols.

You cannot turn it off by you can set it to 1 or any other value.
The max prefetch value can be set either as a connection URL option or as
JVM setting. Please, read [1] or [2] for details how to set it up.

Kind Regards,
Alex

[1]
http://qpid.apache.org/releases/qpid-0.28/programming/book/QpidJNDI.html#section-jms-connection-url

[2]
http://qpid.apache.org/releases/qpid-0.28/jms-client-0-8/book/JMS-Client-0-8-Client-Understanding-Session.html




On 23 June 2014 12:31, lixucheng <[hidden email]> wrote:

> When I use JMS to browse my LVQ, why the queue attribute "Pre-fetched:"
is
> always increase, for example: when I browse 5 messages, the pre-fetched
> will
> be 5 msgs, when I browse the 5 messages again, the pre-fetched will
> increase
> to 10 msgs. Dose anyone know how to turn off the pre-fetched, or set to a

> fix value, do not increase always? Thanks.
>
>
>
> --
> View this message in context:
>
http://qpid.2158936.n2.nabble.com/How-to-turn-off-pre-fetched-when-browse-LVQ-tp7609553.html

> Sent from the Apache Qpid users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>



If you reply to this email, your message will be added to the discussion
below:
http://qpid.2158936.n2.nabble.com/How-to-turn-off-pre-fetched-when-browse-LVQ-tp7609553p7609589.html

To unsubscribe from How to turn off pre-fetched when browse LVQ, click here
.
NAML

3F345097.gif (10K) <http://qpid.2158936.n2.nabble.com/attachment/7609638/0/3F345097.gif>
3F527893.gif (3K) <http://qpid.2158936.n2.nabble.com/attachment/7609638/1/3F527893.gif>
3F421120.gif (3K) <http://qpid.2158936.n2.nabble.com/attachment/7609638/2/3F421120.gif>
graycol.gif (144 bytes) <http://qpid.2158936.n2.nabble.com/attachment/7609638/3/graycol.gif>




--
View this message in context: http://qpid.2158936.n2.nabble.com/How-to-turn-off-pre-fetched-when-browse-LVQ-tp7609553p7609638.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

Re: How to turn off pre-fetched when browse LVQ

Posted by Oleksandr Rudyy <or...@gmail.com>.
Hi,

The maximum prefetch value is set to 500 by default in Qpid JMS client for
AMQP 0.10 and 0.8/0.9.x protocols.

You cannot turn it off by you can set it to 1 or any other value.
The max prefetch value can be set either as a connection URL option or as
JVM setting. Please, read [1] or [2] for details how to set it up.

Kind Regards,
Alex

[1]
http://qpid.apache.org/releases/qpid-0.28/programming/book/QpidJNDI.html#section-jms-connection-url
[2]
http://qpid.apache.org/releases/qpid-0.28/jms-client-0-8/book/JMS-Client-0-8-Client-Understanding-Session.html



On 23 June 2014 12:31, lixucheng <li...@cn.ibm.com> wrote:

> When I use JMS to browse my LVQ, why the queue attribute "Pre-fetched:"  is
> always increase, for example: when I browse 5 messages, the pre-fetched
> will
> be 5 msgs, when I browse the 5 messages again, the pre-fetched will
> increase
> to 10 msgs. Dose anyone know how to turn off the pre-fetched, or set to a
> fix value, do not increase always? Thanks.
>
>
>
> --
> View this message in context:
> http://qpid.2158936.n2.nabble.com/How-to-turn-off-pre-fetched-when-browse-LVQ-tp7609553.html
> Sent from the Apache Qpid users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>