Spring JmsTemplate & WebSphere MQ - 忽略 RECEIVE_TIMEOUT_NO_WAIT

发布于 2024-11-09 11:58:25 字数 2365 浏览 0 评论 0原文

我正在使用 Spring JmsTemplate 和 WebSphere MQ(在 WebSphere App Server 内)。

我按如下方式创建 JmsTemplate 实例:

def templateFor(managerJndiName: String) = {
  val connectionFactory = context.lookup(managerJndiName).asInstanceOf[QueueConnectionFactory]
  val jmsTemplate = new JmsTemplate(connectionFactory)
  jmsTemplate.setReceiveTimeout(JmsTemplate.RECEIVE_TIMEOUT_NO_WAIT)
  jmsTemplate
}

注意,我将超时设置为 no_wait (-1)。然而,线程仍然阻塞。

[5/26/11 11:53:32:183 EST] 0000003d TimeoutManage I   WTRN0124I: When the timeout occurred the thread with which the transaction is, or was most recently, associated was Thread[Default : 2,5,main]. The stack trace of this thread when the timeout occurred was: 
    java.lang.Object.wait(Native Method)
    java.lang.Object.wait(Object.java:167)
    com.ibm.mq.jmqi.remote.internal.system.RemoteProxyQueue.proxyMQGET(RemoteProxyQueue.java:2585)
    com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGetMessage(RemoteFAP.java:5603)
    com.ibm.mq.jmqi.internal.JmqiTools.getMessage(JmqiTools.java:1056)
    com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGet(RemoteFAP.java:5540)
    com.ibm.msg.client.wmq.internal.WMQConsumerShadow.getMsg(WMQConsumerShadow.java:1169)
    com.ibm.msg.client.wmq.internal.WMQSyncConsumerShadow.receiveInternal(WMQSyncConsumerShadow.java:233)
    com.ibm.msg.client.wmq.internal.WMQConsumerShadow.receive(WMQConsumerShadow.java:922)
    com.ibm.msg.client.wmq.internal.WMQMessageConsumer.receive(WMQMessageConsumer.java:450)
    com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receiveInboundMessage(JmsMessageConsumerImpl.java:742)
    com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receive(JmsMessageConsumerImpl.java:321)
    com.ibm.mq.jms.MQMessageConsumer.receive(MQMessageConsumer.java:228)
    com.ibm.ejs.jms.JMSMessageConsumerHandle.receive(JMSMessageConsumerHandle.java:444)
    org.springframework.jms.core.JmsTemplate.doReceive(JmsTemplate.java:669)
    org.springframework.jms.core.JmsTemplate.doReceive(JmsTemplate.java:657)
    org.springframework.jms.core.JmsTemplate$8.doInJms(JmsTemplate.java:613)
    org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:432)
    org.springframework.jms.core.JmsTemplate.receive(JmsTemplate.java:611)
    mypackage.MessageQueue.readMessage(MessageQueue.scala:86)

我错过了什么?

I am using Spring JmsTemplate and WebSphere MQ (inside WebSphere App Server).

I create the JmsTemplate instance as follows:

def templateFor(managerJndiName: String) = {
  val connectionFactory = context.lookup(managerJndiName).asInstanceOf[QueueConnectionFactory]
  val jmsTemplate = new JmsTemplate(connectionFactory)
  jmsTemplate.setReceiveTimeout(JmsTemplate.RECEIVE_TIMEOUT_NO_WAIT)
  jmsTemplate
}

Note, I set the timeout to be no_wait (-1). However, the thread still blocks.

[5/26/11 11:53:32:183 EST] 0000003d TimeoutManage I   WTRN0124I: When the timeout occurred the thread with which the transaction is, or was most recently, associated was Thread[Default : 2,5,main]. The stack trace of this thread when the timeout occurred was: 
    java.lang.Object.wait(Native Method)
    java.lang.Object.wait(Object.java:167)
    com.ibm.mq.jmqi.remote.internal.system.RemoteProxyQueue.proxyMQGET(RemoteProxyQueue.java:2585)
    com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGetMessage(RemoteFAP.java:5603)
    com.ibm.mq.jmqi.internal.JmqiTools.getMessage(JmqiTools.java:1056)
    com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiGet(RemoteFAP.java:5540)
    com.ibm.msg.client.wmq.internal.WMQConsumerShadow.getMsg(WMQConsumerShadow.java:1169)
    com.ibm.msg.client.wmq.internal.WMQSyncConsumerShadow.receiveInternal(WMQSyncConsumerShadow.java:233)
    com.ibm.msg.client.wmq.internal.WMQConsumerShadow.receive(WMQConsumerShadow.java:922)
    com.ibm.msg.client.wmq.internal.WMQMessageConsumer.receive(WMQMessageConsumer.java:450)
    com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receiveInboundMessage(JmsMessageConsumerImpl.java:742)
    com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.receive(JmsMessageConsumerImpl.java:321)
    com.ibm.mq.jms.MQMessageConsumer.receive(MQMessageConsumer.java:228)
    com.ibm.ejs.jms.JMSMessageConsumerHandle.receive(JMSMessageConsumerHandle.java:444)
    org.springframework.jms.core.JmsTemplate.doReceive(JmsTemplate.java:669)
    org.springframework.jms.core.JmsTemplate.doReceive(JmsTemplate.java:657)
    org.springframework.jms.core.JmsTemplate$8.doInJms(JmsTemplate.java:613)
    org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:432)
    org.springframework.jms.core.JmsTemplate.receive(JmsTemplate.java:611)
    mypackage.MessageQueue.readMessage(MessageQueue.scala:86)

What have I missed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

默嘫て 2024-11-16 11:58:25

Because of the hack outlined in the comments of this question I thought I was using Spring 3, but I was using Spring 1. Looking at the code, Spring 1 does not support RECEIVE_TIMEOUT_NO_WAIT

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文