Comments (3)
The key insight is that the consumer does not restart. It was always there.
The client who connected to the consumer went away and crashed but the consumer remained on the server.
When the crashed client - or another client - asks for messages the consumer continues where it was before. By not sending you already acknowledged messages. It does not even know you crashed.
All the start config options - start sequence, time etc - only influence the consumer once and that’s when it is created. After that the behaviour is constant. It will only ever give you unacked messages.
So probably what you want is to make a new consumer each time or use a “ordered consumer”
from nats-server.
After point 3 - the crash or restart - do you send more messages in, do those not get consumed?
The consumer will not deliver an already acked message, you cannot ask it to deliver acked messages again so that part is as designed. But after the restart the consumer should continue to deliver new messages.
from nats-server.
Thank you for your explanation. Let me provide a concrete example to clarify my understanding. Suppose I have two subjects in my stream, S1 and S2, and a durable consumer. After the consumer has acknowledged some messages but before it crashed, the consumer state is as follows (each message does not exceed the ack wait threshold, so no messages will be redelivered):
S1: a1, a2, [a3], a4, a5, a6 ... (acked a3 message)
S2: b1, [b2], b3, b4 ... (acked b2 message)
During the time the consumer is crashed, some new messages arrive, and the stream state becomes:
S1: a1, a2, [a3], a4, a5, a6, | a7, a8 ... (new messages)
S2: b1, [b2], b3, b4, | b5, b6 ... (new messages)
What I expect when the same durable consumer restarts is that it will receive the messages:
from S1: a3, a4, a5, a6, a7, a8, ....
from S2: b2, b3, b4, b5, b6 ...
So, my questions are:
- Can the durable consumer get the last acknowledged message per subject under the
DeliverLastPerSubjectPolicy
delivery policy? - If the above condition is met, can the durable consumer receive the messages in order? (Specifically, must it be [a3, a4, a5, a6, a7] rather than [a7, a8, a3, a4, a5] or another order?)
from nats-server.
Related Issues (20)
- Performance degradation HOT 2
- Comment at end of config file is a parse error HOT 6
- Explicit server route connection retry does not backoff HOT 1
- Dynamic append headers for clients messages HOT 4
- Add support for inline configuration in CLI
- Embedded nats servers with opt.LogFile have no logging HOT 2
- Consumer not receiving messages when power off and restart, consumer's ack floor is ahead of stream's last sequence HOT 12
- Connection between Leafnode and Core NATS over satellite link fails to get established
- NATS Cluster - Dynamically del node HOT 3
- Abnormal NATS write load associated with a specific jetstream HOT 2
- Jetstream KV Cluster loosing data after nodes restart/ HOT 4
- Add the time zone designator to the time when `logtime_utc` is enabled
- WorkQueue jetstream messages are not deleted on non-leader nodes when used as mirror source
- Too many CPU/System resource used after many consumer created in idle cluster HOT 2
- Healthcheck fails when JetStream account is removed from configuration HOT 6
- Reusing Options struct leads to unexpected behavior HOT 3
- Streams getting marked as orphaned and deleted when transitioning from one non-clustered server to a cluster HOT 6
- Flood of STATSZ system events starting nodes in a large cluster
- MQTT Memory Leaks on consumer connections HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nats-server.