Replies: 1 comment
-
Apparently, the simplest way would be to run NATS client on the device itself without a server in the middle. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! I am building a mailbox that client can query for new messages.
In my current implementation client provides last seen offset. I delete all messages with offset less then client provided. Then I fetch all messages with bigger offset from the database. This way if client fails to receive an HTTP response it could retry the request with the old offset.
How could I implement this with NATS?
I see a couple of options:
Option A: Get stream, get persistent consumer, manually inform NATS about last consumer sequence (client provided), fetch the messages.
This is a direct translation from my current implementation.
(5) is nice to have but not necessary. (6) is crucial, on the other hand, and I can't see how to do that without having a Message reference.
Option B: Get stream, create ephemeral consumer that starts from client provided sequence, fetch the messages.
(3) With WorkQueue policy and ephemeral consumer all messages will be deleted once consumer unsubscribes but only acked should be.
Option C: Connect directly to NATS from client's device (skip the server completely).
This is theoretically possible but I wouldn't want to do that.
P.S I am coming from Kafka world...
Beta Was this translation helpful? Give feedback.
All reactions