I have a few clients that are both consumers and subscribers to a single topic on an ActiveMQ message broker. All the clients share the same code, they are in fact using exactly the same Enterprise Application consisting of: (1) an EJB producing a message, and (2) an MDB consuming the message.
The problem is basically that if I have clients A, B and C, and if A sends out a message, then A, B, C will all receive the message. I don't want A to receive its own message.
So I played around with various solutions, the best one I came up with was to set a string property on the outgoing message, e.g. source=myVeryOwnID. Then in the MDB, I set up a message selector like source <> 'myVeryOwnID'.
Unfortunately, that is a poor solution because I would have to set this ID in the source code (in my case, within annotations). This means that when deploying a new client, I cannot simply give the .EAR file to someone, instead I have to specifically re-compile with a unique "source" property.
Ideally, I would like to use the MAC address as the ID, or perhaps an ID set within Glassfish (I am using GFv3).
Any solutions or ideas would be highly appreciated!