File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ Publishing a message to such a Stream will load the most recent message on the s
3333the new message with the latest value in the body. The header is preserved for downstream processing by Sources and for
3434visibility and debugging purposes.
3535
36+ The ` PubAck ` will include the value post-increment for fast feedback, avoiding a Get to get the latest value.
37+
3638``` bash
3739$ nats s get COUNTER --last-for counter.hits
3840Item: COUNTER#22802062 received 2025-01-09 18:05:07.93747413 +0000 UTC on Subject counter.hits
@@ -41,7 +43,8 @@ Headers:
4143 Nats-Incr: +2
4244
4345{" val" :" 100" }
44- $ nats pub counter.hits ' ' -J -H " Nats-Incr:+1"
46+ $ nats req counter.hits ' ' -J -H " Nats-Incr:+1"
47+ {" stream" :" COUNTER" , " domain" :" hub" , " seq" :22802063, " val" :" 101" }
4548$ nats s get COUNTER --last-for counter.hits
4649Item: COUNTER#22802063 received 2025-01-09 18:06:00 +0000 UTC on Subject counter.hits
4750
@@ -81,6 +84,15 @@ We use a `string` value since JavaScript would only support up to `2^53` for num
8184
8285We use a JSON result so we can extend the structure in future, perhaps to indicate data type and more.
8386
87+ The PubAck gets a new field:
88+
89+ ``` go
90+ type PubAck struct {
91+ // ....
92+ Value string ` json:"val,omitempty"`
93+ }
94+ ```
95+
8496## Recounts and Audit
8597
8698It's important in many scenarios that counter values can be audited and recounts can happen. We preserve the ` Nats-Incr `
You can’t perform that action at this time.
0 commit comments