Is there a way to get the source IP address from a JMS message?

I have a system in which different server processes process requests sent as JMS messages from different clients through a JMS broker.

I am trying to determine the source of the messages. Is there a way to get the IP address or some identifying information about the origin?

Clarification: I already have a client deployed by unknown users, so I'm trying to avoid changing message classes ...

+6
jms
source share
7 answers

There is an additional JMS header mentioned in the JMS specification called JMSXUserID that identifies the user sending the message (which the broker checks and ensures that it is correct to avoid spoofing), which some JMS providers support.

For example, how to enable it in Apache ActiveMQ

+3
source share

I don’t believe that. At least I could not find a way.

If you need to send a response to the message source, you can set the sender property "JMSReplyTo" and reply to this message.

Or you can change your messaging scheme a bit and insert the original informational message. The sender identifies himself in the message, and the recipient can read it from there.

+1
source share

If you control the construction of sent messages, you can always add an IP address to the message as a property. You can then check the value using the getStringProperty method in the message.

0
source share

If you control the code of clients sending messages, you can come up with some property name, for example, "IPOfSender", and include this property in every message with Message.setStringProperty ().

// client code String myIPString = ...; Message m = session.createTextMessage(); m.setStringProperty("IPOfSender", myIPString); ... 
0
source share

It depends on your JMS server. Some servers have admin / API tools that allow you to view connection information.

0
source share

Using a glass fish, if you look at the getJMSMessageID () message, you will see a line with the result "ID: 40-192.168.0.242 (f5: 62: c6: 58: 22: 6f) -52506 -122885191641". IP seems to be a substring of the message identifier.

Please note that this is what I see in our setup, so there may be other factors when playing (i.e. spring), but I know that the line was not created by us programmatically.

0
source share

Short answer: NO

0
source share

All Articles