Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a new stream provider for NATS.io.
The provider implementation follow the same approach as others which are based on queues. In this case, we use NATS JetStream stream as the backend "queue".
Each provider registration uses one NATS JetStream Stream. That stream is partitioned based on
NatsOptions.PartitionCount
using the Deterministic subject token partition making each pooling agent responsible for each partition.Unlike all other providers, the state of the consumer is 100% managed by NATS Server. Consumers are named per partition, so if the partition owner changes, the next owner will continue to consume automatically. No need for external checkpoint storage. The provider acknowledge messages delivered upon delivery.
For now, it is implemented as a non-rewindable stream. We can later on enhance it to add rewind support, just need a bit more time and can be done on a separated PR.
Another area to investigate, is to use NATS KV for storage. In particular for
PubSubStorage
. The KV have interesting use cases like for example, external systems can be notified about state changes. That would allow people to self-contain the streaming without any other dependency, but this will go in another PR later.Microsoft Reviewers: Open in CodeFlow