| 644 | } |
| 645 | |
| 646 | func 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. |