Reputation: 153
I am working on migration project. I want to set filters on jms message text. Here JMS messages text content has xml messages. Are there any methods available in jms to add filter on xpath or some text content, or any tools which provide this kind of functionality?
Upvotes: 0
Views: 504
Reputation: 620
The possible solution might be to use an integration framework, i.e. Apache Camel which provide some filter components. Concretely, Apache Camel provides following message filters. I do not know how big your project is, maybe it is an overhead... But it is a solution.
Upvotes: 1
Reputation: 11612
If you can include property in the message header before sending it, then the consumer can filter messages based on it.
You can specify it with annotations. More suitable if filter criteria is fixed.
@ActivationConfigProperty(propertyName = "messageSelector", propertyValue = "xkey = 'xValue'")
Else, can also specify while creating consumer & can provide/build filter criteria at runtime.
String messageSelector = "xkey = 'xValue'"; session.createConsumer(destination, messageSelector);
Otherwise, I don't know other way around. But it would be very difficult to filter messages based on some value in XML message for particular attribute, parsing each object, checking all attributes etc etc.
Upvotes: 0