Skip to content

Commit

Permalink
Update server reconnect behavior during consume()
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Piotrowski <[email protected]>
  • Loading branch information
piotrpio committed Jun 7, 2024
1 parent 3e6a65c commit 13a4063
Showing 1 changed file with 12 additions and 4 deletions.
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

0 comments on commit 13a4063

Please sign in to comment.