问题
How maxMessages property affects the MDB? For example:
@ActivationConfigProperty(propertyName = "maxMessages", propertyValue="5").
How would this value affect if maxSessions is 10?
回答1:
The JBoss docs are a bit wooly on this, they say MaxMessages is defined as
The number of messages to wait for before attempting delivery of the session, each message is still delivered in a separate transaction (default 1)
I think you were wondering if it affects the number of threads or concurrent sessions than can pass through the MDB at one time, but it seems this parameter is not related to that behaviour, and so there's no conflict.
回答2:
I think you're confused, maxSessions
refer to the the maximum number of JMS sessions that can concurrently deliver messages to MDB.
回答3:
In the xml confi file standardjboss.xml you'd set MaximumSize to set the number of concurrent messages. In this case I've set it to 150. This affects all MDBs, however.
<invoker-proxy-binding>
<name>message-driven-bean</name>
<invoker-mbean>default</invoker-mbean>
<proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
<proxy-factory-config>
<JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>
<ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
<CreateJBossMQDestination>true</CreateJBossMQDestination>
<!-- WARN: Don't set this to zero until a bug in the pooled executor is fixed -->
<MinimumSize>1</MinimumSize>
**<MaximumSize>150</MaximumSize>**
<KeepAliveMillis>30000</KeepAliveMillis>
<MaxMessages>1</MaxMessages>
<MDBConfig>
<ReconnectIntervalSec>10</ReconnectIntervalSec>
<DLQConfig>
<DestinationQueue>queue/DLQ</DestinationQueue>
<MaxTimesRedelivered>200</MaxTimesRedelivered>
<TimeToLive>0</TimeToLive>
</DLQConfig>
</MDBConfig>
</proxy-factory-config>
</invoker-proxy-binding>
来源:https://stackoverflow.com/questions/1048725/configuring-an-mdb-in-jboss