为什么只用(not )JBoss EAP 7
创建一个消费者?如何增加消费者数量?Active MQ
Artemis
我试过了:
- 增加 maxSession
ActivationConfigProperty
- 增加 mdb 池大小(通过
bean-instance-pools
标签) connection-definition
在标签内设置最小/最大池大小
我的配置:
mdb 池配置
<subsystem xmlns="urn:jboss:domain:ejb3:5.0">
...
<mdb>
<resource-adapter-ref resource-adapter-name="com.icl.amq.jmsra.rar"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
<pools>
<bean-instance-pools>
<strict-max-pool name="slsb-strict-max-pool" max-pool-size="5" instance-acquisition-timeout="10" instance-acquisition-timeout-unit="MINUTES"/>
<strict-max-pool name="mdb-strict-max-pool" max-pool-size="40" instance-acquisition-timeout="10" instance-acquisition-timeout-unit="MINUTES"/>
</bean-instance-pools>
</pools>
...
资源适配器配置
<subsystem xmlns="urn:jboss:domain:resource-adapters:5.0">
...
<resource-adapter id="amq.jmsra.main">
...
<connection-definitions>
<connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="${amq.jndi.factory}" enabled="true" pool-name="ConnectionFactory">
<xa-pool>
<min-pool-size>10</min-pool-size>
<initial-pool-size>10</initial-pool-size>
<max-pool-size>35</max-pool-size>
</xa-pool>
</connection-definition>
</connection-definitions>
</resource-adapter>
...
数据库代码:
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "connectionFactoryLookup", propertyValue = "${amq.jndi.factory}"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "in_queue"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName="minSessions", propertyValue="5"),
@ActivationConfigProperty(propertyName="maxSessions", propertyValue="40")
})
@ResourceAdapter("amq.jmsra.main")
public class ServerMessageListener implements MessageListener {
...
我希望这种配置会增加消费者的数量,但是当从ActiveMQ
Web 控制台查看队列状态时,我只看到 1 个消费者。