В моем приложении JavaEE я читаю сообщения из очереди и очереди IBM MQ следующим образом:
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class MyMessageHandler implements MessageListener {
@Resource
private MessageDrivenContext context;
@Override
public void onMessage(Message message) {
try {
processMessage(message);
}
catch (Exception e) {
context.setRollbackOnly();
}
}
Приложение развертывается в Jboss EAP 6.4 и адаптере wmq.jms.rar (Реализация -Версия: 7.1.0.0-k000-L111005).Вот конфигурация активации из ejb-jar.xml:
<message-driven>
<display-name>MyMessageHandler</display-name>
<ejb-name>MyMessageHandler</ejb-name>
<ejb-class>org.example.MyMessageHandler</ejb-class>
<transaction-type>Container</transaction-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>hostName</activation-config-property-name>
<activation-config-property-value>${somejbossproperty}</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>port</activation-config-property-name>
<activation-config-property-value>${somejbossproperty}</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>channel</activation-config-property-name>
<activation-config-property-value>${somejbossproperty}</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>queueManager</activation-config-property-name>
<activation-config-property-value>${somejbossproperty}</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>transportType</activation-config-property-name>
<activation-config-property-value>${somejbossproperty}</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>username</activation-config-property-name>
<activation-config-property-value>${somejbossproperty}</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>password</activation-config-property-name>
<activation-config-property-value>${somejbossproperty}</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>${somejbossproperty}</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>acknowledgeMode</activation-config-property-name>
<activation-config-property-value>auto-acknowledge</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
При возникновении исключения транзакция откатывается и сообщение помещается в очередь возврата IBM MQ с использованием механизма возврата IBM MQ.,Однако я отмечаю рост числа подключений, и они не выпускаются.Вот как я отслеживаю количество соединений на сервере IBM MQ:
echo "display conn(*) all" | runmqsc <queue manager name> | grep <the IP of the Jboss server>| wc -l
Почему это может произойти?