简体   繁体   English

如何使用HornetQ处理JMS-Session超时?

[英]How to handle JMS-Session timeout using HornetQ?

can any one explain how to handle JMS-Session timeout.In my application am using Hornetq its working fine after sometime the error will getting( JMS-Session timeout) please help me. 任何人都可以解释如何处理JMS-Session超时。在我的应用程序中使用Hornetq时,它的工作正常,但一段时间后错误会越来越严重(JMS-Session超时),请帮帮我。 public HornetQProducer() { 公共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();

    }
}

Thanks 谢谢

Try to configure connection factory in HornetQ configuration file like this. 尝试像这样在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>

To handle JMS timeout try to work with JMSException. 要处理JMS超时,请尝试使用JMSException。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM