I have several clients who are both consumers and subscribers on the same topic in the ActiveMQ message broker. All clients have the same code, they actually use exactly the same Enterprise Application, consisting of: (1) the EJB that creates the message, and (2) the MDB that consumes the message.
The problem is that if I have clients A, B and C, and if A sends a message, then A, B, C everyone will receive the message. I do not want A to receive his own message.
So, I played with various solutions, the best of which I came up with is to set the line property in the outgoing message, for example. Source = myVeryOwnID . Then in MDB, I set up a message selector, for example source <> 'myVeryOwnID' .
Unfortunately, this is a bad decision, because I will need to set this identifier in the source code (in my case, in the annotations). This means that when deploying a new client, I can’t just transfer the .EAR file to someone, instead I have to specially recompile it with the unique “source” property.
Ideally, I would like to use the MAC address as an identifier, or perhaps the identifier set in Glassfish (I use GFv3).
Any solutions or ideas will be highly appreciated!
source
share