Indeed, having custom filters would lead to loss of performance if the filtering logic does some heavy work, but I believe it is the responsibility of the user to whether accept the overhead depending on the use-case. Also the custom filter will not exclusively deal with the body, it could just be complex logic applied a message header.
The way I see this is instead of baking complex logic directly in the ‘artemis-selector’ project (just how ‘XPATH’ and ‘XQUERY’), why not have this logic somewhere else. For example, if I need to do some JSONPath filtering, I will just do some sort of “CALL ‘jsonpath’(‘<jsonpath-expression>’)”, with a config somewhere associating ‘jsonpath’ to ‘com.my.pkg.FilterUtils::createJsonPathExpression’. Our use-case is somewhat similar to what’s described above, and I feel like this feature could potentially unlock many other use-cases. I could open a pull-request tomorrow to showcase what I’ve achieved; we can then discuss the correct way of implementing this. Hamza De : Justin Bertram <jbert...@apache.org> Date : mercredi, 5 juin 2024 à 18:45 À : users@activemq.apache.org <users@activemq.apache.org>, Hamza HATHOUTE <hamza.hathout...@thalesdigital.io> Objet : Re: ActiveMQ Artemis Custom Filters [You don't often get email from jbert...@apache.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] It's hard to say whether it's a "good idea," per se. However, if you can extend the broker to fit your use-case that's really what open-source is all about. Typically the concern with filtering is performance since the filter needs to be evaluated for every single message sent to the queue. For example, by default filters work on message headers and properties, but there's an XPATH feature [1] that can filter on the _body_ of a message which could potentially execute much more slowly causing latency increases for all producers and increased CPU utilization on the broker. If your filter implementation is doing something relatively slow then it may have a sizable impact on performance. It's possible this is a bit of functionality that we could incorporate into the code-base to benefit all users. Would you be willing to put together a pull-request? Also, could you elaborate on your use-case? What exactly are you implementing with the new filter? Justin [1] https://fra01.safelinks.protection.outlook.com/?url=https%3A%2F%2Factivemq.apache.org%2Fcomponents%2Fartemis%2Fdocumentation%2Flatest%2Ffilter-expressions.html%23xpath&data=05%7C02%7Chamza.hathoute.e%40thalesdigital.io%7Cb2ceb1ea2a664150782e08dc857ee782%7C737c6905f1864bcfafb343e349ee23a3%7C0%7C0%7C638532027322343072%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=S7YDrZuzFfmn6FF5bZATr%2Ffh%2BltFClEwIr%2BaMJBkaT8%3D&reserved=0<https://activemq.apache.org/components/artemis/documentation/latest/filter-expressions.html#xpath> On Wed, Jun 5, 2024 at 11:05 AM Hamza HATHOUTE <hamza.hathout...@thalesdigital.io.invalid> wrote: > Hello, > > I would like to ask whether it is a good idea to have custom filtering for > queues. > > I’m thinking about having a jar with a static method that creates an > instance of BooleanExpression. The filter would be something like “CALL > ‘com__external__pkg__Class__functionName’(param1, …)”. > > I’ve made some changes to the ‘artemis-selector’ project to implement > this, looks like it is feasible, therefore my question. > > Of course, I understand that this filter will only be used for server-side > filtering. > > Thanks, > > Hamza > > > This message contains confidential information and is intended only for > the individual(s) addressed in the message. If you are not the named > addressee, you should not disseminate, distribute, or copy this e-mail. If > you are not the intended recipient, you are notified that disclosing, > distributing, or copying this e-mail is strictly prohibited. > This message contains confidential information and is intended only for the individual(s) addressed in the message. If you are not the named addressee, you should not disseminate, distribute, or copy this e-mail. If you are not the intended recipient, you are notified that disclosing, distributing, or copying this e-mail is strictly prohibited.