I have an MDB in Jboss 7 application that acts as a consumer of a queue in ActiveMQ. This is how the connection is made from JBoss
/subsystem=resource-adapters/resource-adapter=activemq-rar-5.6.0.rar/config-properties="ServerUrl":add(value="tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=1")
On the MDB these are the annotations:
@MessageDriven(name = "MyConsumerMessageBean", activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "myQueue"),
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "maxSessions", propertyValue="2")})
@ResourceAdapter(value = "activemq-rar-5.6.0.rar")
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
When JBoss connects to Active MQ I see that the value of jms.prefetchPolicy.queuePrefetch=1 is passed to the activeMQ server in the connection attempt as shown in the JBoss server log.
2014-08-28 21:33:04,183 INFO [org.apache.activemq.ra.ActiveMQEndpointWorker] (default-short-running-threads-threads - 3) Successfully established connection to broker [tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=1]
However, when I look at the ActiveMQ queue screen and drill down to this consumer, I see that the value of PreFetch Max Pending column is 20. Where is this number 20 coming from and why is the value of 1 not being honored by ActiveMQ.
I have also tried to set other value "jms.prefetchPolicy.all=1" via the same mechanism and that didn't work either. I am on JBoss AS 7.1.1 Final and ActiveMQ 5.6.0
Thanks