Queued pull consumers with WorkQueue retention #963
-
Hey, I'm currently working on an event-sourcing library that uses NATS as the primary backend for the event bus implementations but I'm struggling with the implementation of the JetStream driver. Users of the library should be able to configure to either use NATS Core, JetStream with push consumers, or JetStream with pull consumers when creating the event bus. The first two scenarios work out but I can't get queues to work with pull consumers like it's mentioned here and here because of a limitation of the Here's how I tried to design the "JetStream Pull Consumer" event bus:
A consumer is created for each event to support load-balancing between replicas of a (micro)service, so that Problem is that the Stream per eventI also tried to create one stream per event and then – for each event that a service subscribes to – create a consumer without a filter subject. Problem here is that the library needs to support wildcard subscriptions on all possible events using the So, anyone has an idea how this could be implemented? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
A workqueue binds a stream to a single consumer and semantic. You can bind as may pull subscribers as you want to that consumer however for horizontal scalability. If you have a mixed mode semantics for a stream and want multiple and mutually exclusive consumers, try the interest retention policy. |
Beta Was this translation helpful? Give feedback.
A workqueue binds a stream to a single consumer and semantic. You can bind as may pull subscribers as you want to that consumer however for horizontal scalability.
If you have a mixed mode semantics for a stream and want multiple and mutually exclusive consumers, try the interest retention policy.