Replies: 1 comment 2 replies
-
Hi @Tazer, At the moment you would have to rely on your container orchestration (or something as simple as shell scripts) to start exactly n instances of your consuming process each one working against its own partition stream+consumer. If one of those consuming processes crashes or gets killed the container orchestration system should restart them and as long as you are using durable consumers when the consuming application gets restarted and reconnects it will continue from the last message it received. If you need to reload state each time when you restart one of those consuming applications then you would re-create the consumer for the partition each time. To detect if one of those consuming processes gets hung and stops pulling messages you would regularly get the consumer info for the n consumers and you can tell 'how far behind' the consumer is WRT the head of the stream, or you could also use the 'working queue' discard policy for the stream and look at the size of each partition's stream. |
Beta Was this translation helpful? Give feedback.
-
Hello,
We are looking into a PoC with NATS (currently using RabbitMQ and some PoC with Kafka).
The only problem I'm not being able to solve theoretically at least is:
Background
We have some services that are not really good at "horizontal scaling" cause they need to keep an in memory state, and load it on startup.
So they are stateful. This mean that it's fine IF only one consumer is working a single partition.
Kafka solution
The kafka solution is to use partition key and then each "connected" consumer in the group will gets
1..n
partitions.IF a consumer is disconnecting then there will be a rebalance event for all consumers so remaning consumers get
1..n
partitions and each consumer can "reload states"NATS Jetstream
Feels its close with Subject Mapping & Partitioning and using a DeliverGroup for the consumers.
The missing parts are:
There are some talk about something similar here but not the exact use case. #2043
If it doesn't make sense I can try to clarify any parts.
Beta Was this translation helpful? Give feedback.
All reactions