任何人都可以解释如何处理JMS-Session超时。在我的应用程序中使用Hornetq它的工作正常一段时间后错误将得到(JMS-Session超时)请帮助我。 公共HornetQProducer(){
try {
ic = getInitialContext();
cf = (ConnectionFactory) ic.lookup("/ConnectionFactory");
queue = new HornetQQueue("ExampleQueue");
connection = cf.createConnection();
logger.info("Connection object of HornetQ <<<>>>>>>>" + connection);
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
messageProducer = session.createProducer(queue);
connection.start();
logger.info("Message Producer HornetQ....." + messageProducer);
} catch (NamingException e) {
e.printStackTrace();
} catch (JMSException e) {
e.printStackTrace();
}
}
谢谢
答案 0 :(得分:1)
尝试在HornetQ配置文件中配置连接工厂。
<connection-factory name="NettyConnectionFactory">
<xa>false</xa>
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="/ConnectionFactory"/>
</entries>
<retry-interval>1000</retry-interval>
<retry-interval-multiplier>1.0</retry-interval-multiplier>
<reconnect-attempts>1</reconnect-attempts>
</connection-factory>
要处理JMS超时,请尝试使用JMSException。