rogerdpack
rogerdpack

Reputation: 66911

activemq consumer seems to "always cache"?

I noticed with activemq (5.5) if I do this pseudocode:

connection = new ActiveMQConnectionFactory(...)
connection.start()
session = connection.createSession(transacted=true, Session.AUTO_ACKNOWLEDGE)
destination = session.createQueue(...)
consumer = session.createConsumer(destination) 

That the consumer appears to grab an element from the queue, before I even request one. Even if I do wireFormat.cacheEnabled=false

Anybody know how to prevent a consumer from "grabbing an element" by default?

Upvotes: 2

Views: 2179

Answers (1)

Brian Roach
Brian Roach

Reputation: 76918

Add &jms.prefetchPolicy.all=0 to your connect string and see if that stops it. The prefetch policy defaults are fairly large and I suspect that's the behavior you're seeing.

Be aware though that prefetch isn't necessarily a bad thing: http://activemq.apache.org/what-is-the-prefetch-limit-for.html

Upvotes: 3

Related Questions