简体   繁体   English

如何在JMS 2中创建临时队列并访问它

[英]How to create temporary queue and access it in JMS 2

I am working on a JMS client server app where client first send some data to server through a common queue for all clients and server gives respond to it in a temporary queue created by client itself. 我正在开发一个JMS客户端服务器应用程序,客户端首先通过所有客户端的公共队列向服务器发送一些数据,服务器在客户端自己创建的临时队列中对其进行响应。 I googled it but could not find how can I implement it in JMS 2 as the traditional approach of creating temporary queue is by using session but in JMS 2 I am using JMSContext through which I am creating producer and consumer. 我用Google搜索但无法找到如何在JMS 2中实现它,因为创建临时队列的传统方法是使用会话,但在JMS 2中我使用JMSContext,我通过它创建生产者和消费者。 My question is how and where 我的问题是如何以及在何处

In the JMS 2.0 JMSContext API the createTemporaryQueue and createTemporaryTopic server the same role as the traditional versions did in the JMS 1.1 Session style. 在JMS 2.0 JMSContext API中,createTemporaryQueue和createTemporaryTopic服务器与传统版本在JMS 1.1会话样式中的作用相同。 The JMSContext is really just wrapping the ideas of Connection and Session into one object. JMSContext实际上只是将Connection和Session的思想包装到一个对象中。

You also have all the same methods create creating messages and setting JMSReplyTo on them, in the consumer you need to consume a Message instance and then use the getJMSReplyTo to get at the reply queue 您还可以使用所有相同的方法创建消息并在其上设置JMSReplyTo,在消费者中需要使用Message实例,然后使用getJMSReplyTo获取应答队列

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

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