We have a need to filter messages based on criteria that is too complex for
Selectors. Our messages are in a proprietary binary format, so filtering
with XPATH or XQUERY is not an option.
The filtering must work off a string message property which contains a
comma-separated list of values. Subscribers will be filtered
based on values, at least one of which must exist in the list. To make it
more complicated, the values in the list may contain
wildcards, and subscribers may be assigned multiple acceptable values.
For example:
msg property "authKeys" : "AAA,AAB,AB?"
client authorized for: "ABB,BAA"
* ABB matches AB?
Looking through selectors, BrokerFilter's messagePull(), Subscription
(matches), and BooleanExpression has not yielded a working solution. The
closest was a custom BooleanExpression, but that failed with a network of
brokers when the openwire transport attempted to marshal the custom object
that was added using setAdditionalPredicate() on the ConsumerInfo object;
the result was a cast exception since my custom object didn't implement
DataStructure.
It would be best to use a solution that propogates through a network of
brokers, like a selector, to reduce network traffic and avoid potential
problems with stuck messages on queues, but that may not be necessary.
At this point, I think the best approach is adding a custom
regular-expression syntax to selectors - perhaps using a function syntax.
Such as:
REGEX ( <regex-exp>, <candidate> )
For example:
REGEX ( authKeys, "ABB,BAA" )
Would such an update be accepted into the build? If not, any
recommendations would be appreciated.
--
View this message in context:
http://activemq.2283324.n4.nabble.com/custom-selector-filter-for-messages-tp3090334p3090334.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.