MCPcopy
hub / github.com/nats-io/nats.go / ExampleMsg_AckSync

Function ExampleMsg_AckSync

example_test.go:646–661  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

644}
645
646func ExampleMsg_AckSync() {
647 nc, _ := nats.Connect("localhost")
648 js, _ := nc.JetStream()
649
650 // Set custom timeout for a JetStream API request.
651 js.AddStream(&nats.StreamConfig{
652 Name: "FOO",
653 Subjects: []string{"foo"},
654 })
655
656 sub, _ := js.SubscribeSync("foo")
657 msg, _ := sub.NextMsg(2 * time.Second)
658
659 // Wait for ack of an ack.
660 msg.AckSync()
661}
662
663// When a message has been delivered by JetStream, it will be possible
664// to access some of its metadata such as sequence numbers.

Callers

nothing calls this directly

Calls 6

ConnectMethod · 0.80
JetStreamMethod · 0.80
NextMsgMethod · 0.80
AckSyncMethod · 0.80
AddStreamMethod · 0.65
SubscribeSyncMethod · 0.65

Tested by

no test coverage detected