Reputation: 5557
Before you mark this a duplicate, I have tried looking on all the relevant post here; but unable to find relevant post.
My problem statement is:
To filter a MapMessage based on certain key/value pair in its body content.
The EE tutorial suggest that
The message consumer then receives only messages whose headers and properties match the selector. A message selector cannot select messages on the basis of the content of the message body.
However, since the JMS implementations are vendor specific, I would like to know if it is possible to filter MapMessage based on key/value in Apache activemq implementation.
(As an example, active MQ supports XPath based selectors when working with messages containing XML bodies. Check here)
or
Is it possible to override the selector (by inheritance, or implementing a new selector) and plug the same with activemq to achieve the result?
Thanks.
Upvotes: 1
Views: 886
Reputation: 18401
Besides the XPath option for XML based messages I'm not aware of anything else we've added to ActiveMQ that would allow you to operate on the Message contents. Selecting on the contents of the message would probably add some significant performance overhead and is tricky for things like bytes message etc.
There is one options you could try if you really think this is something that you can't live without. We do have a feature where function like calls can be made in the selector and you can add more custom functions which could allow you to back door something in but might require some trickery, see this issue for the details. The commit log on the issue will show you the code added and the test case to give you an idea of how it works.
Upvotes: 1