Add jetstream.WithJetStreamMessage to make ack/nak-ing less messy, use process context in consumers

This commit is contained in:
Neil Alexander 2022-01-05 13:45:27 +00:00
parent 1e92206fbc
commit 51de6612a6
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
11 changed files with 412 additions and 385 deletions

View 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()
}
}