创建临时队列
我尝试在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来您似乎以错误的顺序执行此操作。通常,消费者通过打开临时队列进行输入来创建临时队列,然后使用该对象填充请求消息上的回复字段。服务提供商应用程序在预定义的众所周知的队列上侦听请求消息,然后使用请求中的 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.
根据 J2EE 1.4 文档:
我怀疑您正在尝试从不同的连接进行消费。
According to the J2EE 1.4 documents:
I suspect you are trying to consume from a different connection.