Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update server reconnect behavior during consume() #286

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions adr/ADR-37.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
| Status | Approved |
| Tags | jetstream, client, spec |

## Release History

| Revision | Date | Description |
|----------|------------|-----------------------------------------------------|
| 1 | 2023-05-30 | Initial stable release |
| 2 | 2024-06-07 | Change server reconnect behavior during `consume()` |

## Context and Problem Statement

Consuming messages from a JetStream require a large number of options and design
Expand Down Expand Up @@ -313,16 +320,17 @@ Clients should detect server disconnect and reconnect.

When a disconnect event is received, client should:

- Reset the heartbeat timer.
- Pause the heartbeat timer.
- Stop publishing new pull requests.

When a reconnect event is received, client should:

- Resume the heartbeat timer.
- Check if consumer exists (fetch consumer info). If consumer is not available, terminate `Consume()` execution with error.
This operation may have to be retried several times as JetStream may not be immediately available.
- Reset the heartbeat timer.
- Publish a new pull request.

Clients should never terminate the `Consume()` call on disconnect and reconnect
events and should not check if consumer is still available after reconnect.

###### Message processing algorithm

Below is the algorithm for receiving and processing messages.
Expand Down
Loading