> For the complete documentation index, see [llms.txt](https://docs.natsclub.cn/cn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.natsclub.cn/cn/yi-chan/stan/streaming/acks.md).

# Acknowledgements

## Acknowledgements

Subscribers can use auto-ack or manual-ack. Auto-ack is the default for most clients and is sent by the library when the message callback returns. Manual ack provides more control. The subscription options provide flags to:

* Set manual acks to true
* Set the ack wait used by the server for messages to this subscription

The ack wait is the time the server will wait before resending a message.

```go
sub, err := sc.Subscribe("foo",
  func(m *stan.Msg) {
    m.Ack()
  }, stan.SetManualAckMode(), stan.AckWait(aw))
```

> Note that if processing a particular message exceeds ack wait, the following behavior can be observed with [queue subscriptions](/cn/yi-chan/stan/streaming/queues.md): 1. Subscriber A receives the message. 2. Subscriber A exceeds ack wait time and Subscriber B receives the message. 3. Subscriber B exceeds ack wait time and Subscriber C receives the message. 6. Subscriber A finishes processing and acknowledges the message. 7. Re-delivery of the message ceases.
>
> How often the message is re-delivered depends on processing time for the message and available subscriber.

## Max In Flight

Subscribers can set max in flight to rate limit incoming messages. The server will send at most “max in flight” messages before receiving an acknowledgement. Setting max in flight to 1 insures every message is processed in order.

```go
sc.Subscribe("foo", func(m *stan.Msg) {...},
   stan.SetManualAckMode(),
   stan.MaxInflight(25))
```

## Redelivery of Acknowledged Messages

See the explanation in [nats-streaming-concepts/channels/subscriptions/redelivery](/cn/yi-chan/stan/intro/channels/subscriptions/redelivery.md#redelivery-of-acknowledged-messages).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.natsclub.cn/cn/yi-chan/stan/streaming/acks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
