Reconnecting JMS listener to JBossMQ

后端 未结 4 732
轮回少年
轮回少年 2020-12-15 09:11

We have a Java listener that reads text messages off of a queue in JBossMQ. If we have to reboot JBoss, the listener will not reconnect and start reading messages again. We

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-15 09:27

    If you're purely a listener and do no other JMS calls other than connection setup, then the "onException() handler" answer is correct.

    If you do any JMS calls in your code, just using onException() callback isn't sufficient. Problems are relayed from the JMS provider to the app either via an exception on a JMS method call or through the onException() callback. Not both.

    So if you call any JMS methods from your code, you'll also want to invoke that reconnection logic if you get any exceptions on those calls.

提交回复
热议问题