-
Hi, I see a lot of questions related to kafka-like partitioning and every answer mentions subject mapping to calculate/add partition number to a subject, however I don't see anything related to how to deal with consumption afterwards. Let's say I partitioned subjects. Created multiple stream per partition (also why separate streams ?). I have a service consuming messages for a specific subject containing some events from customers - customer id and also partition number - a part of a subject. Now I want to increase replicas count - how a consumer/subscription/application should be configured to allow reading sequentially (by customer id order) from partitioned streams. The question is only related to consumption and setup on client side. I have found no examples, only some assumptions related to KV. Please advise. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
For the partitioned consumption of messages you do not need to use more than one stream. You can just use one stream, use subject transformation in that stream to insert a partition number automatically as part of the subject (e.g. the first token of the subject) and then you can create a consumer per partition (using a subject filter that only matches the messages with that particular partition number). You could even have one consumer per instance of your consuming application and have multiple partitions per instance. There is an implementation of all this (Golang) that is all ready to go (initial version of course) and that I am hoping to be able to release soon (it will be in the Orbit repo), but unfortunately while 2.11 has now finally been released I'm still waiting for some of it's new features to be exposed in the nats.go client library before I can release that consumer group library. But essentially this is all described in this PR nats-io/nats-architecture-and-design#263 |
Beta Was this translation helpful? Give feedback.
-
A client side library implementing static and elastic 'partitioned consumer groups' functionality has now just be released in Orbit.go: https://github.com/synadia-io/orbit.go/releases/tag/pcgroups%2Fv0.1.0 (and https://github.com/synadia-io/orbit.go/blob/pcgroups/v0.1.0/pcgroups/README.md) |
Beta Was this translation helpful? Give feedback.
A client side library implementing static and elastic 'partitioned consumer groups' functionality has now just be released in Orbit.go: https://github.com/synadia-io/orbit.go/releases/tag/pcgroups%2Fv0.1.0 (and https://github.com/synadia-io/orbit.go/blob/pcgroups/v0.1.0/pcgroups/README.md)