JmsTemplate没有发送超时 [英] JmsTemplate has no send timeout

查看:449
本文介绍了JmsTemplate没有发送超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有使用 spring

它与正确的队列信息一起正常工作,但是当我输入错误的队列信息时

It works well with correct queue information , but when i give wrong queue information

它挂在

LOG.info("SENDING MESSAGE");
jmsTemplate.send(this.getDestination(), messageCreator );  //here

我有我的日志说正在发送消息,我正在处理org.springframework.jmsexception,但是它不会抛出.....我认为它当时已挂起.

I have my Log saying sending message , i am handling org.springframework.jmsexception , but it does not throw.....i think it is hung at that point.

我找不到jmstemplate的任何属性来发送超时,仅存在接收超时...

I am not able to find any property for jmstemplate for send timeout , only for recieve timeout is there...

这是 app-context.xml(春季)中的 jmstemplate conf

<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate102">
        <property name="connectionFactory">
            <ref bean="jmsQueueConnectionFactory" />
        </property>
        <property name="destinationResolver">
            <ref bean="jmsDestinationResolver" />
        </property>
        <property name="pubSubDomain">
            <value>false</value>
        </property>
        <property name="receiveTimeout">
            <value>20000</value>

        </property>

ibm mq conf -

<bean id="mqConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
        <property name="hostName">
            <value>${queue_hostname}</value>
        </property>
        <property name="port">
            <value>${queue_port}</value>
        </property>
        <property name="queueManager">
            <value>${queue_manager}</value>
        </property>
        <property name="channel">
            <value>${queue_channel}</value>
        </property>
        <property name="transportType">
            <value>1</value>
        </property>
    </bean>

我将其设置为自动确认

this.jmsTemplate.setSessionAcknowledgeMode(Session.AUTO_ACKNOWLEDGE);

所以请告诉我如何在发送消息时超时以抛出 jmsexception .

So please tell me how to have timeout on sending message to throw jmsexception.

推荐答案

这都是没有道理的.

如果尝试将消息放入无效队列,则MQ IMMEDIATELY会引发异常,原因码为2085(未知对象).无需超时.显然,您正在使用的框架存在一个错误,即它没有捕获引发的异常!!!

If you attempt to put a message to an invalid queue, MQ IMMEDIATELY throws an exception with a reason code 2085 (unknown object). There is no timeout required. Obviously, the framework you are using has a bug in it that it is not catching the thrown exception!!!

仅使用JMS和MQ尝试相同的测试,就会发现差异.

Try the same test using just JMS and MQ, and you will see the difference.

这篇关于JmsTemplate没有发送超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆