简体   繁体   English

如何获取jms消息源的jndi名称

[英]How can I get the jndi name of the source of a jms message

I am using the Spring Session Aware Message Listener to listen to multiple JMS queues. 我正在使用Spring Session Aware Message Listener来侦听多个JMS队列。 Is there any way to get the JNDI name of the source of an incoming message? 有什么方法可以获取传入消息源的JNDI名称? I have tried to use the getJMSDestination, but this only gives me the display name. 我尝试使用getJMSDestination,但这仅给我显示名称。

Thank you. 谢谢。

I don't think you can. 我认为你不能。 The source might not even have a JNDI name - if, for example the message is sent from the messaging provider console, or from spring (rather than from an app server). 源甚至可能没有JNDI名称-例如,如果消息是从消息传递提供者控制台发送的,或者是从spring(而不是从应用程序服务器)发送的。

I think the message doesn't hold any information about the sender, unless it manually includes it in the form of properties. 我认为该消息不包含有关发件人的任何信息,除非它以属性的形式手动包含它。

Update: The same goes for the destinations - they are uniquely identified by messaging provider name, which again may lack a JNDI name. 更新:目的地也一样-它们由消息传递提供程序名称唯一标识,该名称可能也缺少JNDI名称。 For example I'm now using ActiveMQ with spring, and there are no JNDI names whatsoever. 例如,我现在将ActiveMQ与spring一起使用,并且没有任何JNDI名称。 The JNDI name is the name by which the client refers to a certain Topic/Queue inside its container and is not an information stored in the JMS message. JNDI名称是客户端引用其容器内某个主题/队列的名称,而不是JMS消息中存储的信息。

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

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