-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JMS Selectors: apply selectors on the write path (initial prototype) #123
Conversation
if (filterResult == EntryFilter.FilterResult.REJECT) { | ||
String property = "filter-result-" + name + "@" + subscription.getTopicName(); | ||
publishContext.setProperty(property, filterResult); | ||
publishContext.setProperty(JMS_FILTERED_PROPERTY, true); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A follow up optimization can use these fields to skip the post filtering step.
// ir is possible that calling this method in this thread may affect performance | ||
// let's keep it simple for now, we can optimize it later | ||
subscription.acknowledgeMessage( | ||
Collections.singletonList(new PositionImpl(ledgerId, entryId)), | ||
CommandAck.AckType.Individual, | ||
null); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure acknowledging the message should be fast. It might get slowed down by synchronization, but I would expect the pre-filtering to be the thing that is most disruptive.
Nice work! |
This change adds a new BrokerInterceptor that applies the Filters on the Write Path and acknowledges the message that don't match the filter.
With this change the backlog metric is more accurate and there is less work to do while dispatching the messages.
In the other hand, we are adding more load on the write path.
Please note that we still have to apply the filter while dispatching the messages because:
How to enable this feature:
You also have to copy the jms filters .nar file into the 'interceptors' directory (the same file you put in the 'filters' directory)