Replies: 3 comments 2 replies
-
For round robin type of behavior, look to JetStream and pull consumers which are round robin. |
Beta Was this translation helpful? Give feedback.
-
This is the best place to look for examples how to leverage Pull Consumers @derekcollison mentioned: https://github.com/nats-io/nats.go/blob/v1.31.0/jetstream/README.md#continuous-polling |
Beta Was this translation helpful? Give feedback.
-
Thanks for the pointer. This worked to get round-robin functionality doing js.Publish and cons.Messages(1) / msg.Ack on consumer. Does req/reply semantics work with jetstream? |
Beta Was this translation helpful? Give feedback.
-
I was experimenting with nats and testing how messages are handled by consumers in a q group. I see that docs says that messages are spread randomly to consumers but was wondering if there is an option somewhere to set to make it process say in a round robin manner? I see reference to this (#610) which implies messages more evenly split among consumers. I have this code and multiple runs indicates that split is not even
this is o/p i get - subscriber 5 getting 3 messages, subscriber 2 getting twice
Subscriber : 8 foo.4 message 4
Subscriber : 10 foo.1 message 1
Subscriber : 5 foo.5 message 5
Subscriber : 1 foo.7 message 7
Subscriber : 5 foo.2 message 2
Subscriber : 5 foo.9 message 9
Subscriber : 4 foo.8 message 8
Subscriber : 2 foo.6 message 6
Subscriber : 1 foo.10 message 10
Subscriber : 2 foo.3 message 3
Beta Was this translation helpful? Give feedback.
All reactions