From 04b3bdc1b33a9d2013fadd4381482a28eb88a6e9 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Tue, 1 Sep 2026 11:18:53 +0200 Subject: [PATCH] Fix reconnection attempt count in ReactorNettyTcpClient Prior to this commit, the reconnection attempt count provided to the reconnect strategy would not give the updated, incremented value but instead the previous one. This commit fixes this and ensures the value is incremented before it's given to the strategy. Fixes gh-37223 --- .../messaging/tcp/reactor/ReactorNettyTcpClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-messaging/src/main/java/org/springframework/messaging/tcp/reactor/ReactorNettyTcpClient.java b/spring-messaging/src/main/java/org/springframework/messaging/tcp/reactor/ReactorNettyTcpClient.java index a70b13aea3b..92d3f6befd4 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/tcp/reactor/ReactorNettyTcpClient.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/tcp/reactor/ReactorNettyTcpClient.java @@ -222,7 +222,7 @@ public class ReactorNettyTcpClient

implements TcpOperations

{ .map(retrySignal -> (int) retrySignal.totalRetriesInARow()) .flatMap(attempt -> reconnect(attempt, strategy)))) .repeatWhen(flux -> flux - .scan(1, (count, element) -> count++) + .scan(1, (count, element) -> count + 1) .flatMap(attempt -> reconnect(attempt, strategy))) .subscribe(); return connectFuture;