Is there any way to filter messages in ActiveMQ Artemis 2.10.0 by part of the "text" field using the management console?
I use method "browse(java.lang.String)" and try to filter my message (example below) by this expression:
text LIKE '%777-555-333-111%'
Message example:
{
"address": "ADDRESS.EXAMPLE",
"ShortProperties": {},
"messageID": "11111",
"priority": 4,
"type": 3,
"redelivered": false,
"ByteProperties": {
"_AMQ_ROUTING_TYPE": 1
},
"IntProperties": {
"CamelHttpResponseCode": 200
},
"durable": true,
"StringProperties": {
"Server": "nginx/1.19.5",
"CamelHttpCharacterEncoding": "UTF-8",
"Content_HYPHEN_Type": "application/xop+xml",
"connection": "keep-alive"
},
"DoubleProperties": {},
"expiration": 0,
"text": "<?xml version="1.0" encoding="UTF-8" standalone="yes"?><processId>777-555-333-111</processId></error>",
"BooleanProperties": {},
"FloatProperties": {}
}
However, it doesn’t give me any results.
Would be grateful for a hint if it possible on my current Artemis version.
2
Answers
The filter used by the
browse
management operation (as well as that used by JMS consumers, etc.) only applies to message headers and properties. You can’t filter a message by the text in its body.The data that you pasted is just the serialized message data sent to the client after the filter has already been applied.
Apache ActiveMQ Artemis also supports special XPath filters which operate on
the body of a message. The body must be XML, see the documentation for further details.
To use an XPath filter use this syntax: