Jboss 在MessageListener上实现ExceptionListener
我们的结构如下: BaseQueue->在复制队列中复制消息(这是我们读取消息的地方) 通过wmq.jmsra.rar资源适配器连接到队列管理器/队列 所以我只想从队列中读取消息。我不想回信 因此,我实现了一个MessageListener,并通过ejb-jar.xml文件配置了队列 这一切都很好,但现在我想实现一个ExceptionListener来处理连接丢失等问题 我认为只需实现ExceptionListener接口就可以了,如下所示:Jboss 在MessageListener上实现ExceptionListener,jboss,ibm-mq,jboss-eap-6,Jboss,Ibm Mq,Jboss Eap 6,我们的结构如下: BaseQueue->在复制队列中复制消息(这是我们读取消息的地方) 通过wmq.jmsra.rar资源适配器连接到队列管理器/队列 所以我只想从队列中读取消息。我不想回信 因此,我实现了一个MessageListener,并通过ejb-jar.xml文件配置了队列 这一切都很好,但现在我想实现一个ExceptionListener来处理连接丢失等问题 我认为只需实现ExceptionListener接口就可以了,如下所示: public class MdB implement
public class MdB implements MessageListener, ExceptionListener {
@Override
public void onMessage(Message arg0) {
...
}
@Override
public void onException(JMSException arg0) {
...
}
}
但这似乎还不够,因为资源适配器从未调用过OneException方法
有人能帮我吗?也许获取资源适配器使用的连接并为此对象设置异常侦听器就足够了,但我找不到获取连接对象的方法
connection.setExceptionListener(this); // class implementing the ExceptionListener interface
谢谢您还需要通过调用连接对象上的
setExceptionListener
向连接注册异常侦听器
connection.setExceptionListener(this); // class implementing the ExceptionListener interface
额外阅读
setExceptionListener
向连接注册异常侦听器
connection.setExceptionListener(this); // class implementing the ExceptionListener interface
额外阅读