seeday opened a new pull request #7629:
URL: https://github.com/apache/pulsar/pull/7629
<!--
### Contribution Checklist
- Name the pull request in the form "[Issue XYZ][component] Title of the
pull request", where *XYZ* should be replaced by the actual issue number.
Skip *Issue XYZ* if there is no associated github issue for this pull
request.
Skip *component* if you are unsure about which is the best component.
E.g. `[docs] Fix typo in produce method`.
- Fill out the template below to describe the changes contributed by the
pull request. That will give reviewers the context they need to do the review.
- Each pull request should address only one issue, not mix up code from
multiple issues.
- Each commit in the pull request has a meaningful commit message
- Once all items of the checklist are addressed, remove the above text and
this checklist, leaving only the filled out template below.
**(The sections below can be removed for hotfixes of typos)**
-->
### Motivation
Broker-side filtering of messages can reduce the network load significantly
when running certain types of highly-filtered jobs. Example usecases are flink
filter-pushdown, displaying data over websocket, and other network-limited
actions.
So far, the list of available filters is pretty small, but this framework
should make writing new ones relatively easy.
### Modifications
I've modified the pulsar protocol such that clients can send a spec for
filtering to the broker. The broker's Consumer class builds a filter from the
arguments sent as well as the class name. I've gone with reflection because
that makes for easy extension and customization of the available filters.
### Verifying this change
- [ ] Make sure that the change passes the CI checks.
This change added tests and can be verified as follows:
- the new tests in
MessageFilteringTest/SimpleTypedMessageProducerConsumerTest should pass
- all other tests should be unaffected by the changes
### Does this pull request potentially affect one of the following parts:
*If `yes` was chosen, please highlight the changes*
- Dependencies (does it add or upgrade a dependency): (yes / **no**)
- The public API: (**yes** / no)
- a new function is added to the consumer to allow for constructing a
message filter
- The schema: (yes / **no** / don't know)
- The default values of configurations: (yes / **no**)
- The wire protocol: (**yes** / no)
- a new field was added to commandsubscribe to send info about the
message filter
- The rest endpoints: (yes / **no**)
- The admin cli options: (yes / **no**)
- Anything that affects deployment: (yes / **no** / don't know)
### Documentation
- Does this pull request introduce a new feature? (**yes** / no)
- If yes, how is the feature documented? (not applicable / docs /
**JavaDocs** / not documented)
- once this is in a more stable state, an entry in the actual docs is
probably necessary.
- If a feature is not applicable for documentation, explain why?
- If a feature is not documented yet in this PR, please create a followup
issue for adding the documentation
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]