Hi Vadim,
I created a testcase for this to verify that the prefetch buffer works
as expected and it does not fail. Please review it to see if you are
doing anything substancially different:
public void testPrefetch1MessageNotDispatched() throws Exception {
// Set prefetch to 1
connection.getPrefetchPolicy().setAll(1);
connection.start();
Session session = connection.createSession(true, 0);
destination = new ActiveMQQueue("TEST");
MessageConsumer consumer = session.createConsumer(destination);
// Send 2 messages to the destination.
sendMessages(session, destination, 2);
session.commit();
// Only pick up the first message.
Message message1 = message1 = consumer.receive(1000);
assertNotNull(message1);
// Don't acknowledge yet. This should keep our prefetch full.
// Since prefetch is still full, the 2nd message should get
dispatched to
// another consumer.. lets create the 2nd consumer test that
it does make sure it does.
ActiveMQConnection connection2 = (ActiveMQConnection)
factory.createConnection();
connections.add(connection2);
Session session2 = connection2.createSession(true, 0);
MessageConsumer consumer2 = session2.createConsumer(destination);
// Only pick up the 2nd messages.
Message message2 = consumer.receive(1000);
assertNotNull(message2);
session.commit();
session2.commit();
assertNull(consumer.receiveNoWait());
}
On 8/1/06, Hiram Chirino <[EMAIL PROTECTED]> wrote:
Weird.I'll try to dig through this. We may have some dispatching logic
that is off by one.
On 8/1/06, Vadim Pesochinsky <[EMAIL PROTECTED]> wrote:
>
> I am using transacted sessions, yet this is what I see. Every time there is a
> long job, e.g. 5 min 20 sec, next message this consumer processes has the
> queue wait time of 5 min 20 sec. What can I try to make it work?
> CLIENT_ACKNOWLEDGE? Thanks.
> --
> View this message in context:
http://www.nabble.com/Trouble-with-prefetch-buffer.-tf2029800.html#a5603579
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>
--
Regards,
Hiram
Blog: http://hiramchirino.com
--
Regards,
Hiram
Blog: http://hiramchirino.com