From 13a4063b7d0ab93d2da85600e1b53f2831e47a31 Mon Sep 17 00:00:00 2001 From: Piotr Piotrowski Date: Fri, 7 Jun 2024 15:28:57 +0200 Subject: [PATCH] Update server reconnect behavior during `consume()` Signed-off-by: Piotr Piotrowski --- adr/ADR-37.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/adr/ADR-37.md b/adr/ADR-37.md index 2d3f333..16b0989 100644 --- a/adr/ADR-37.md +++ b/adr/ADR-37.md @@ -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 @@ -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.