客户端监控连接ActiveMQ状态
1、spring配置文件中配置exceptionListener
<bean id="exceptionListener" ref="connectionFactory"></property>
<property name="destination" ref="messageListenerQueue"></property>
<property name="messageListener" ref="messageListener"></property>
<property name="exceptionListener" ref="exceptionListener"></property>
</bean>
2、创建TempExceptionListener实现javax.jms.ExceptionListener接口
@Override
? ? public void onException(JMSException e) {
? ? ? ? LOG.error("TempExceptionListener 收到消息:" + e);
? ? ? ? LOG.warn("发送监控告警~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
? ? ? ??
? ? }