mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 14:12:47 +00:00
Add jetstream.WithJetStreamMessage
to make ack/nak-ing less messy, use process context in consumers
This commit is contained in:
parent
1e92206fbc
commit
51de6612a6
11 changed files with 412 additions and 385 deletions
11
setup/jetstream/helpers.go
Normal file
11
setup/jetstream/helpers.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
package jetstream
|
||||
|
||||
import "github.com/nats-io/nats.go"
|
||||
|
||||
func WithJetStreamMessage(msg *nats.Msg, f func(msg *nats.Msg) bool) {
|
||||
if f(msg) {
|
||||
_ = msg.Ack()
|
||||
} else {
|
||||
_ = msg.Nak()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue