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
Jetstream: Support for multiple "filter subject" patterns in consumer #2515
Comments
I think this is really needed, |
Any update on this please? Thank you. |
Yes, we're looking into this. |
Random idea on this topic: why not using Common Expression Language (cf. Go implementation) in order to filter out all kind of message based on their attributes?
This could also be extended to do some payload-based filtering with support for some serialization (JSON, protobuf, ...):
|
This might be better served through our callout architecture which is underway. We prefer to try to keep the server as simple as we can. |
Just found this issue. My own app architecture would also be greatly simplified if I could comma separate my interest declaration. Any update on the roadmap for this? |
@autodidaddict PR introducing this change already has been merged into Additionally, #3500 - implementation PR |
Sweet thanks for the update |
The title start with JetStream but is this only applicable to JetStream? I believe Nats Core also support this case, right? |
It only apply to jetstream since consumer is a notion of jetstream. |
Since this issue is still open, this was not part of 2.10 I guess? |
Yes this has been released in 2.10. Announcement post, docs, and 2.10 guide coming up next week. |
Ah ok great. Thank you. |
Feature Request
Similar to how a stream can be configured to bind multiple subject patterns, this request is to allow for a consumer to be configured with multiple filter subject patterns. Currently only one pattern can be specified.
Use Case:
My specific use case is modeling an event sourcing type of workload where I am modeling subjects as entities/state machines/workflows and there are a sequence of events written per subject. There are cases where I need to consume events from more than one subject in order to process a new command.
Currently, I am managing this by consume a broader scope of the stream, e.g.
events.>
and then doing local filtering. Supporting multiple filter subjects would make the consumers more targeted and reduce the data transferred and latency since it would be filtered server-side.Also to clarify, this is all scoped to subjects in a single stream, not across streams, since I know that is a different problem (but interesting in its own right!)
Proposed Change:
To not break compatibility with the singular
FilterSubject
, this would add a new fieldFilterSubjects
to take a slice of filter patterns.Who Benefits From The Change(s)?
Anyone need to create a consumer with disjoint subjects, specifically not supported by wildcard hierarchy, e.g.
[]string{"foo.bar", "baz.qux"}
or selecting specific subjects where a wildcard match would yield too much data,[]string{"foo.1", "foo.2"}
(wherefoo.*
may have thousands or millions).Alternative Approaches
The alternatives are either to do local filtering with a broader scoped filter or to creating multiple consumers per specific filter and combine the events/messages locally.
The text was updated successfully, but these errors were encountered: