-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove
retry
from block and add acknowledgement to getting start
- Loading branch information
Showing
3 changed files
with
24 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Acknowledgment | ||
|
||
Since unexpected errors may occur during message processing, **FastStream** has an `ack_policy` parameter. | ||
|
||
`AckPolicy` have 4 variants: | ||
|
||
- `ACK` means that the message will be acked anyway. | ||
|
||
- `NACK_ON_ERROR` means that the message will be nacked if an error occurs during processing and consumer will receive this message one more time. | ||
|
||
- `REJECT_ON_ERROR` means that the message will be rejected if an error occurs during processing and consumer will not receive this message again. | ||
|
||
- `DO_NOTHING` in this case *FastStream* will do nothing with the message. You must ack/nack/reject the message manually. | ||
|
||
|
||
You must provide this parameter when initializing the subscriber. | ||
|
||
```python linenums="1" hl_lines="5" title="main.py" | ||
from faststream import AckPolicy | ||
from faststream.nats import NatsBroker | ||
|
||
broker = NatsBroker() | ||
@broker.subscriber(ack_policy=AckPolicy.REJECT_ON_ERROR) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters