创建临时队列

发布于 2024-08-04 17:27:08 字数 1211 浏览 8 评论 0原文

我尝试在 JMS 中创建和使用 TemporaryQueue。我的生产者成功了,但我的消费者却失败了,并出现以下错误。我知道这个问题可能需要完整的代码,但它非常冗长,我确信没有人愿意对此进行排序。但是,如果我在这里给出的答案不是那么明显,请随时向我指出任何处理 TemporaryQueues 或 TempTopics 的资源,谢谢。

[编辑] 我忘记附加代码和错误:

导致错误的代码:

QueueReceiver myRecv = mySession.createReceiver(myQueue);

错误:

CWSIA0086E: Failed to create a MessageConsumer for queue://_Q_CBF079A6A1E3018A0000000000262775?busName=myBus2
    at com.ibm.ws.sib.api.jms.impl.JmsMsgConsumerImpl.createCoreConsumer(JmsMsgConsumerImpl.java:689)
    at com.ibm.ws.sib.api.jms.impl.JmsMsgConsumerImpl.<init>(JmsMsgConsumerImpl.java:391)
    at com.ibm.ws.sib.api.jms.impl.JmsQueueReceiverImpl.<init>(JmsQueueReceiverImpl.java:58)
at com.ibm.ws.sib.api.jms.impl.JmsQueueSessionImpl.instantiateConsumer(JmsQueueSessionImpl.java:203)
at com.ibm.ws.sib.api.jms.impl.JmsSessionImpl.createConsumer(JmsSessionImpl.java:950)
at com.ibm.ws.sib.api.jms.impl.JmsSessionImpl.createConsumer(JmsSessionImpl.java:900)
at com.ibm.ws.sib.api.jms.impl.JmsQueueSessionImpl.createReceiver(JmsQueueSessionImpl.java:123)
at com.ibm.ws.sib.api.jms.impl.JmsQueueSessionImpl.createReceiver(JmsQueueSessionImpl.java:100)

I have tried to create and use a TemporaryQueue in JMS. My producer succeeds but my consumer fails at this like, with the following error. I understand that this question may require the full code, but it is very lengthly and I am sure no one wants to sort though that. However, if the answer is not so obvious from what I have given here, please feel free to point me to any resources that deal with TemporaryQueues or TempTopics, thank you.'

[Edit]
I forgot to attach the code and error:

Code causing error:

QueueReceiver myRecv = mySession.createReceiver(myQueue);

Error:

CWSIA0086E: Failed to create a MessageConsumer for queue://_Q_CBF079A6A1E3018A0000000000262775?busName=myBus2
    at com.ibm.ws.sib.api.jms.impl.JmsMsgConsumerImpl.createCoreConsumer(JmsMsgConsumerImpl.java:689)
    at com.ibm.ws.sib.api.jms.impl.JmsMsgConsumerImpl.<init>(JmsMsgConsumerImpl.java:391)
    at com.ibm.ws.sib.api.jms.impl.JmsQueueReceiverImpl.<init>(JmsQueueReceiverImpl.java:58)
at com.ibm.ws.sib.api.jms.impl.JmsQueueSessionImpl.instantiateConsumer(JmsQueueSessionImpl.java:203)
at com.ibm.ws.sib.api.jms.impl.JmsSessionImpl.createConsumer(JmsSessionImpl.java:950)
at com.ibm.ws.sib.api.jms.impl.JmsSessionImpl.createConsumer(JmsSessionImpl.java:900)
at com.ibm.ws.sib.api.jms.impl.JmsQueueSessionImpl.createReceiver(JmsQueueSessionImpl.java:123)
at com.ibm.ws.sib.api.jms.impl.JmsQueueSessionImpl.createReceiver(JmsQueueSessionImpl.java:100)

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

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

发布评论

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

评论(2

为你鎻心 2024-08-11 17:27:08

看起来您似乎以错误的顺序执行此操作。通常,消费者通过打开临时队列进行输入来创建临时队列,然后使用该对象填充请求消息上的回复字段。服务提供商应用程序在预定义的众所周知的队列上侦听请求消息,然后使用请求中的 Reply-To 字段来处理响应。通过这种方式,生产者应用程序根据收到的请求发现动态队列。

动态队列通常不用作请求或数据报消息的目的地。这些用例需要消费者侦听的预定义的众所周知的队列。动态队列几乎总是用于请求-答复交换中的答复消息。

It seems as though you are doing this in the wrong order. Typically the consumer creates the temporary queue by opening it for input and then uses that object to fill in the Reply-To fields on a request message. The service provider application listens on a pre-defined, well-known queue for the request message and then uses the Reply-To fields from the request to address the response. In this way the producer app discovers the dynamic queue based on the request received.

Dynamic queues are generally not used as the destination for a request or datagram message. These use cases call for a pre-defined, well-known queue which the consumer listens on. Dynamic queues are almost always for the reply message in a request-reply exchange.

冬天旳寂寞 2024-08-11 17:27:08

根据 J2EE 1.4 文档

TemporaryQueue 对象是在连接期间创建的唯一队列对象。它是系统定义的队列,只能由创建它的连接使用。

我怀疑您正在尝试从不同的连接进行消费。

According to the J2EE 1.4 documents:

A TemporaryQueue object is a unique Queue object created for the duration of a Connection. It is a system-defined queue that can be consumed only by the Connection that created it.

I suspect you are trying to consume from a different connection.

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