在Spring中创建临时JMS jms主题 [英] Creating temporary JMS jms topic in Spring

查看:111
本文介绍了在Spring中创建临时JMS jms主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试重构一些遗留代码,以使用Spring来处理与大型机服务的jms连接。我需要连接为大型机服务回复创建一个临时主题,并在发送消息之前在消息中将其设置为 message.setJMSReplyTo(replyTo);

I'm trying to refactor some legacy code to use Spring to handle the jms connections to a mainframe service. I need to connect create a temporary topic for the mainframe service reply and set that as the message.setJMSReplyTo(replyTo); in the message before I send the message.

任何人都可以举例说明吗?我没有在文档中找到任何允许您访问低级jms对象(例如会话或TopicConnection)以创建临时主题的内容。

Can anyone provide examples of this? I have not found anything in the documentation that allows you to get to the low level jms objects such as the session or TopicConnection in order to create a temporary topic.

推荐答案

如果您需要使用 JmsTemplate 对JMS API进行低级访问,那么您需要使用 JmsTemplate的执行(...) 方法。其中最简单的是 execute(SessionCallBack) ,其中SessionCallback为您提供JMS Session对象。有了它,您可以调用 createTemporaryQueue() createTemporaryTopic()。你可以使用其他一个execute()方法为你做一些初步工作,例如 this this

If you need low-level access to the JMS API using JmsTemplate, then you need to use one of JmsTemplate's execute(...) methods. The simplest of these is execute(SessionCallBack), where the SessionCallback provides you with the JMS Session object. With that, you can call createTemporaryQueue() or createTemporaryTopic(). You can probably use one of the other execute() methods do some of the initial work for you, though, such as this one.

这篇关于在Spring中创建临时JMS jms主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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