From 0148e11853459ac6e914f34a5803644f8650f243 Mon Sep 17 00:00:00 2001 From: Oleg Date: Fri, 20 Oct 2023 17:06:50 +0400 Subject: [PATCH 1/8] Descrease timeout for sending on each attempt --- .../java/com/exactpro/th2/FixHandler.java | 59 ++++++++++++++++--- .../com/exactpro/th2/FixHandlerSettings.java | 10 ++++ 2 files changed, 61 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/exactpro/th2/FixHandler.java b/src/main/java/com/exactpro/th2/FixHandler.java index 40e4edc..147c5ec 100644 --- a/src/main/java/com/exactpro/th2/FixHandler.java +++ b/src/main/java/com/exactpro/th2/FixHandler.java @@ -165,6 +165,8 @@ public class FixHandler implements AutoCloseable, IHandler { private final AtomicReference> heartbeatTimer = new AtomicReference<>(CompletableFuture.completedFuture(null)); private final AtomicReference> testRequestTimer = new AtomicReference<>(CompletableFuture.completedFuture(null)); + + private final TimeoutSendHandler timeoutSendHandler; private Future reconnectRequestTimer = CompletableFuture.completedFuture(null); private volatile IChannel channel; protected FixHandlerSettings settings; @@ -235,9 +237,10 @@ public FixHandler(IHandlerContext context) { if (settings.getHeartBtInt() <= 0) throw new IllegalArgumentException("HeartBtInt cannot be negative or zero"); if (settings.getTestRequestDelay() <= 0) throw new IllegalArgumentException("TestRequestDelay cannot be negative or zero"); if (settings.getDisconnectRequestDelay() <= 0) throw new IllegalArgumentException("DisconnectRequestDelay cannot be negative or zero"); - if (settings.getConnectionTimeoutOnSend() <= 0) { - throw new IllegalArgumentException("connectionTimeoutOnSend must be greater than zero"); - } + this.timeoutSendHandler = new TimeoutSendHandler( + settings.getConnectionTimeoutOnSend(), + settings.getMinConnectionTimeoutOnSend() + ); } @Override @@ -276,7 +279,7 @@ private CompletableFuture send(@NotNull ByteBuf body, @NotNull Map send(@NotNull ByteBuf body, @NotNull Map send(@NotNull ByteBuf body, @NotNull Map deadline) { // The method should have checked exception in signature... ExceptionUtils.rethrow(new TimeoutException(String.format("session was not established within %d mls", - settings.getConnectionTimeoutOnSend()))); + currentTimeout))); } } @@ -1167,4 +1171,43 @@ private void debug(String message, Object... args) { LOGGER.debug("{} - {}: {}", channel.getSessionGroup(), channel.getSessionAlias(), String.format(message, args)); } } + + private static class TimeoutSendHandler { + private final long maxTimeout; + private final long minTimeout; + private long currentTimeout; + + TimeoutSendHandler(long maxTimeout, long minTimeout) { + if (maxTimeout < minTimeout) { + throw new IllegalArgumentException("max timeout must be greater than min timeout"); + } + if (maxTimeout <= 0) { + throw new IllegalArgumentException("connectionTimeoutOnSend must be greater than zero"); + } + if (minTimeout <= 0) { + throw new IllegalArgumentException("minConnectionTimeoutOnSend must be greater than zero"); + } + this.maxTimeout = maxTimeout; + this.minTimeout = minTimeout; + currentTimeout = maxTimeout; + } + + public void getWithTimeout(Future future) throws ExecutionException, InterruptedException, TimeoutException { + try { + future.get(currentTimeout, TimeUnit.MILLISECONDS); + currentTimeout = maxTimeout; + } catch (ExecutionException | InterruptedException | TimeoutException ex) { + currentTimeout = Math.max(minTimeout, currentTimeout / 2); + throw ex; + } + } + + public long getCurrentTimeout() { + return currentTimeout; + } + + public long getDeadline() { + return System.currentTimeMillis() + currentTimeout; + } + } } \ No newline at end of file diff --git a/src/main/java/com/exactpro/th2/FixHandlerSettings.java b/src/main/java/com/exactpro/th2/FixHandlerSettings.java index 99a21ce..4e7e0a2 100644 --- a/src/main/java/com/exactpro/th2/FixHandlerSettings.java +++ b/src/main/java/com/exactpro/th2/FixHandlerSettings.java @@ -75,6 +75,8 @@ public class FixHandlerSettings implements IHandlerSettings { */ private long connectionTimeoutOnSend = DEFAULT_CONNECTION_TIMEOUT_ON_SEND; + private long minConnectionTimeoutOnSend = 1_000; + @JsonDeserialize(using = DateTimeFormatterDeserializer.class) private DateTimeFormatter sendingDateTimeFormat = DateTimeFormatter.ofPattern("yyyyMMdd-HH:mm:ss.SSSSSSSSS"); @@ -317,4 +319,12 @@ public long getConnectionTimeoutOnSend() { public void setConnectionTimeoutOnSend(long connectionTimeoutOnSend) { this.connectionTimeoutOnSend = connectionTimeoutOnSend; } + + public long getMinConnectionTimeoutOnSend() { + return minConnectionTimeoutOnSend; + } + + public void setMinConnectionTimeoutOnSend(long minConnectionTimeoutOnSend) { + this.minConnectionTimeoutOnSend = minConnectionTimeoutOnSend; + } } From 1f25416029b00dbcc4317d3b2a9ba001dbc2ec20 Mon Sep 17 00:00:00 2001 From: Oleg Date: Fri, 20 Oct 2023 17:09:19 +0400 Subject: [PATCH 2/8] Set min timeout in tests --- src/test/java/com/exactpro/th2/FixHandlerSendTimeoutTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/java/com/exactpro/th2/FixHandlerSendTimeoutTest.java b/src/test/java/com/exactpro/th2/FixHandlerSendTimeoutTest.java index 4353258..5e81642 100644 --- a/src/test/java/com/exactpro/th2/FixHandlerSendTimeoutTest.java +++ b/src/test/java/com/exactpro/th2/FixHandlerSendTimeoutTest.java @@ -59,6 +59,7 @@ void sendTimeoutOnConnectionOpen() { settings.setPort(42); settings.setHost("localhost"); settings.setConnectionTimeoutOnSend(300); // 300 millis + settings.setMinConnectionTimeoutOnSend(100); Mockito.when(contextMock.getSettings()) .thenReturn(settings); var fixHandler = new FixHandler(contextMock); @@ -100,6 +101,7 @@ void sendTimeoutOnSessionEnabled() { settings.setPort(42); settings.setHost("localhost"); settings.setConnectionTimeoutOnSend(300); // 300 millis + settings.setMinConnectionTimeoutOnSend(100); LocalTime currentTime = LocalTime.now(ZoneOffset.UTC); int deltaMinutes = currentTime.isAfter(LocalTime.NOON) ? -1 From 1875f69a3b9f1827f34afa80b454aea02ec8335d Mon Sep 17 00:00:00 2001 From: Oleg Date: Mon, 23 Oct 2023 10:11:55 +0400 Subject: [PATCH 3/8] Add event notification when sending successful after failed attempts --- .../java/com/exactpro/th2/FixHandler.java | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/exactpro/th2/FixHandler.java b/src/main/java/com/exactpro/th2/FixHandler.java index 147c5ec..6344683 100644 --- a/src/main/java/com/exactpro/th2/FixHandler.java +++ b/src/main/java/com/exactpro/th2/FixHandler.java @@ -57,6 +57,8 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.ReentrantLock; +import java.util.function.Consumer; + import kotlin.jvm.functions.Function1; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.exception.ExceptionUtils; @@ -65,6 +67,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.annotation.concurrent.NotThreadSafe; + import static com.exactpro.th2.conn.dirty.fix.FixByteBufUtilKt.findField; import static com.exactpro.th2.conn.dirty.fix.FixByteBufUtilKt.findLastField; import static com.exactpro.th2.conn.dirty.fix.FixByteBufUtilKt.firstField; @@ -239,7 +243,8 @@ public FixHandler(IHandlerContext context) { if (settings.getDisconnectRequestDelay() <= 0) throw new IllegalArgumentException("DisconnectRequestDelay cannot be negative or zero"); this.timeoutSendHandler = new TimeoutSendHandler( settings.getConnectionTimeoutOnSend(), - settings.getMinConnectionTimeoutOnSend() + settings.getMinConnectionTimeoutOnSend(), + context::send ); } @@ -1172,12 +1177,15 @@ private void debug(String message, Object... args) { } } + @NotThreadSafe private static class TimeoutSendHandler { + private final Consumer eventConsumer; private final long maxTimeout; private final long minTimeout; private long currentTimeout; + private int attempts; - TimeoutSendHandler(long maxTimeout, long minTimeout) { + TimeoutSendHandler(long maxTimeout, long minTimeout, Consumer eventConsumer) { if (maxTimeout < minTimeout) { throw new IllegalArgumentException("max timeout must be greater than min timeout"); } @@ -1189,19 +1197,34 @@ private static class TimeoutSendHandler { } this.maxTimeout = maxTimeout; this.minTimeout = minTimeout; + this.eventConsumer = requireNonNull(eventConsumer, "event consumer"); currentTimeout = maxTimeout; } public void getWithTimeout(Future future) throws ExecutionException, InterruptedException, TimeoutException { try { future.get(currentTimeout, TimeUnit.MILLISECONDS); + if (attempts > 0) { + generateEvent(attempts); + } currentTimeout = maxTimeout; + attempts = 0; } catch (ExecutionException | InterruptedException | TimeoutException ex) { currentTimeout = Math.max(minTimeout, currentTimeout / 2); + attempts += 1; throw ex; } } + private void generateEvent(int attempts) { + eventConsumer.accept( + Event.start().endTimestamp() + .status(Event.Status.FAILED) + .name("Message sending attempt successful after " + attempts + " failed attempt(s)") + .type("MessageSendingAttempts") + ); + } + public long getCurrentTimeout() { return currentTimeout; } From c6f3b541d084f2ce0ad99e3df28a5dbc43a19141 Mon Sep 17 00:00:00 2001 From: Oleg Date: Mon, 23 Oct 2023 10:55:11 +0400 Subject: [PATCH 4/8] Migrate to atomics for holding current state --- .../java/com/exactpro/th2/FixHandler.java | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/exactpro/th2/FixHandler.java b/src/main/java/com/exactpro/th2/FixHandler.java index 6344683..bb26780 100644 --- a/src/main/java/com/exactpro/th2/FixHandler.java +++ b/src/main/java/com/exactpro/th2/FixHandler.java @@ -55,6 +55,7 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.ReentrantLock; import java.util.function.Consumer; @@ -67,7 +68,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.concurrent.NotThreadSafe; +import javax.annotation.concurrent.ThreadSafe; import static com.exactpro.th2.conn.dirty.fix.FixByteBufUtilKt.findField; import static com.exactpro.th2.conn.dirty.fix.FixByteBufUtilKt.findLastField; @@ -1177,13 +1178,13 @@ private void debug(String message, Object... args) { } } - @NotThreadSafe + @ThreadSafe private static class TimeoutSendHandler { private final Consumer eventConsumer; private final long maxTimeout; private final long minTimeout; - private long currentTimeout; - private int attempts; + private final AtomicLong currentTimeout; + private final AtomicInteger attempts = new AtomicInteger(); TimeoutSendHandler(long maxTimeout, long minTimeout, Consumer eventConsumer) { if (maxTimeout < minTimeout) { @@ -1198,20 +1199,20 @@ private static class TimeoutSendHandler { this.maxTimeout = maxTimeout; this.minTimeout = minTimeout; this.eventConsumer = requireNonNull(eventConsumer, "event consumer"); - currentTimeout = maxTimeout; + currentTimeout = new AtomicLong(maxTimeout); } public void getWithTimeout(Future future) throws ExecutionException, InterruptedException, TimeoutException { try { - future.get(currentTimeout, TimeUnit.MILLISECONDS); - if (attempts > 0) { - generateEvent(attempts); + future.get(currentTimeout.get(), TimeUnit.MILLISECONDS); + int spentAttempts = attempts.getAndSet(0); + if (spentAttempts > 0) { + generateEvent(spentAttempts); } - currentTimeout = maxTimeout; - attempts = 0; + currentTimeout.set(maxTimeout); } catch (ExecutionException | InterruptedException | TimeoutException ex) { - currentTimeout = Math.max(minTimeout, currentTimeout / 2); - attempts += 1; + attempts.incrementAndGet(); + currentTimeout.updateAndGet(cur -> Math.max(minTimeout, cur / 2)); throw ex; } } @@ -1226,11 +1227,11 @@ private void generateEvent(int attempts) { } public long getCurrentTimeout() { - return currentTimeout; + return currentTimeout.get(); } public long getDeadline() { - return System.currentTimeMillis() + currentTimeout; + return System.currentTimeMillis() + currentTimeout.get(); } } } \ No newline at end of file From d5ec5ff4500fad34ce71c0519cf9037e476b80b6 Mon Sep 17 00:00:00 2001 From: Oleg Date: Mon, 23 Oct 2023 11:25:06 +0400 Subject: [PATCH 5/8] Use locks under the hood --- .../java/com/exactpro/th2/FixHandler.java | 55 +++++++++++++++---- 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/exactpro/th2/FixHandler.java b/src/main/java/com/exactpro/th2/FixHandler.java index bb26780..fdba77f 100644 --- a/src/main/java/com/exactpro/th2/FixHandler.java +++ b/src/main/java/com/exactpro/th2/FixHandler.java @@ -57,7 +57,9 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.function.Consumer; import kotlin.jvm.functions.Function1; @@ -68,6 +70,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.annotation.concurrent.GuardedBy; import javax.annotation.concurrent.ThreadSafe; import static com.exactpro.th2.conn.dirty.fix.FixByteBufUtilKt.findField; @@ -1183,8 +1186,11 @@ private static class TimeoutSendHandler { private final Consumer eventConsumer; private final long maxTimeout; private final long minTimeout; - private final AtomicLong currentTimeout; - private final AtomicInteger attempts = new AtomicInteger(); + private final ReadWriteLock lock = new ReentrantReadWriteLock(); + @GuardedBy("lock") + private long currentTimeout; + @GuardedBy("lock") + private int attempts; TimeoutSendHandler(long maxTimeout, long minTimeout, Consumer eventConsumer) { if (maxTimeout < minTimeout) { @@ -1199,20 +1205,35 @@ private static class TimeoutSendHandler { this.maxTimeout = maxTimeout; this.minTimeout = minTimeout; this.eventConsumer = requireNonNull(eventConsumer, "event consumer"); - currentTimeout = new AtomicLong(maxTimeout); + currentTimeout = maxTimeout; } public void getWithTimeout(Future future) throws ExecutionException, InterruptedException, TimeoutException { try { - future.get(currentTimeout.get(), TimeUnit.MILLISECONDS); - int spentAttempts = attempts.getAndSet(0); - if (spentAttempts > 0) { - generateEvent(spentAttempts); + long timeout = getCurrentTimeout(); + + future.get(timeout, TimeUnit.MILLISECONDS); + + int attempts; + lock.writeLock().lock(); + try { + attempts = this.attempts; + this.attempts = 0; + currentTimeout = maxTimeout; + } finally { + lock.writeLock().unlock(); + } + if (attempts > 0) { + generateEvent(attempts); } - currentTimeout.set(maxTimeout); } catch (ExecutionException | InterruptedException | TimeoutException ex) { - attempts.incrementAndGet(); - currentTimeout.updateAndGet(cur -> Math.max(minTimeout, cur / 2)); + lock.writeLock().lock(); + try { + attempts += 1; + currentTimeout = Math.max(minTimeout, currentTimeout / 2); + } finally { + lock.writeLock().unlock(); + } throw ex; } } @@ -1227,11 +1248,21 @@ private void generateEvent(int attempts) { } public long getCurrentTimeout() { - return currentTimeout.get(); + lock.readLock().lock(); + try { + return currentTimeout; + } finally { + lock.readLock().unlock(); + } } public long getDeadline() { - return System.currentTimeMillis() + currentTimeout.get(); + lock.readLock().lock(); + try { + return System.currentTimeMillis() + currentTimeout; + } finally { + lock.readLock().unlock(); + } } } } \ No newline at end of file From 234b32912bf18ec4279de81859840f966e2feb4d Mon Sep 17 00:00:00 2001 From: Oleg Date: Mon, 23 Oct 2023 13:32:24 +0400 Subject: [PATCH 6/8] Move handler to the core part --- build.gradle | 2 +- .../java/com/exactpro/th2/FixHandler.java | 107 ++---------------- 2 files changed, 9 insertions(+), 100 deletions(-) diff --git a/build.gradle b/build.gradle index 2cd4ecb..a0c4058 100644 --- a/build.gradle +++ b/build.gradle @@ -52,7 +52,7 @@ dependencies { } implementation "com.exactpro.th2:common-utils:2.2.0-dev" implementation 'com.exactpro.th2:netty-bytebuf-utils:0.0.1' - implementation 'com.exactpro.th2:conn-dirty-tcp-core:3.2.1-dev' + implementation 'com.exactpro.th2:conn-dirty-tcp-core:3.3.0-th2-5050-6611272114-703d0b2-SNAPSHOT' implementation 'com.exactpro.th2:grpc-lw-data-provider:2.2.0-dev' implementation 'org.slf4j:slf4j-api' diff --git a/src/main/java/com/exactpro/th2/FixHandler.java b/src/main/java/com/exactpro/th2/FixHandler.java index fdba77f..21261bb 100644 --- a/src/main/java/com/exactpro/th2/FixHandler.java +++ b/src/main/java/com/exactpro/th2/FixHandler.java @@ -24,6 +24,7 @@ import com.exactpro.th2.common.utils.event.transport.EventUtilsKt; import com.exactpro.th2.conn.dirty.fix.FixField; import com.exactpro.th2.conn.dirty.fix.MessageLoader; +import com.exactpro.th2.conn.dirty.tcp.core.SendingTimeoutHandler; import com.exactpro.th2.conn.dirty.tcp.core.api.IChannel; import com.exactpro.th2.conn.dirty.tcp.core.api.IChannel.SendMode; import com.exactpro.th2.conn.dirty.tcp.core.api.IHandler; @@ -55,12 +56,8 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; -import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.function.Consumer; import kotlin.jvm.functions.Function1; import org.apache.commons.lang3.StringUtils; @@ -70,9 +67,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.concurrent.GuardedBy; -import javax.annotation.concurrent.ThreadSafe; - import static com.exactpro.th2.conn.dirty.fix.FixByteBufUtilKt.findField; import static com.exactpro.th2.conn.dirty.fix.FixByteBufUtilKt.findLastField; import static com.exactpro.th2.conn.dirty.fix.FixByteBufUtilKt.firstField; @@ -174,7 +168,7 @@ public class FixHandler implements AutoCloseable, IHandler { private final AtomicReference> heartbeatTimer = new AtomicReference<>(CompletableFuture.completedFuture(null)); private final AtomicReference> testRequestTimer = new AtomicReference<>(CompletableFuture.completedFuture(null)); - private final TimeoutSendHandler timeoutSendHandler; + private final SendingTimeoutHandler sendingTimeoutHandler; private Future reconnectRequestTimer = CompletableFuture.completedFuture(null); private volatile IChannel channel; protected FixHandlerSettings settings; @@ -245,9 +239,9 @@ public FixHandler(IHandlerContext context) { if (settings.getHeartBtInt() <= 0) throw new IllegalArgumentException("HeartBtInt cannot be negative or zero"); if (settings.getTestRequestDelay() <= 0) throw new IllegalArgumentException("TestRequestDelay cannot be negative or zero"); if (settings.getDisconnectRequestDelay() <= 0) throw new IllegalArgumentException("DisconnectRequestDelay cannot be negative or zero"); - this.timeoutSendHandler = new TimeoutSendHandler( - settings.getConnectionTimeoutOnSend(), + this.sendingTimeoutHandler = SendingTimeoutHandler.create( settings.getMinConnectionTimeoutOnSend(), + settings.getConnectionTimeoutOnSend(), context::send ); } @@ -288,7 +282,7 @@ private CompletableFuture send(@NotNull ByteBuf body, @NotNull Map send(@NotNull ByteBuf body, @NotNull Map eventConsumer; - private final long maxTimeout; - private final long minTimeout; - private final ReadWriteLock lock = new ReentrantReadWriteLock(); - @GuardedBy("lock") - private long currentTimeout; - @GuardedBy("lock") - private int attempts; - - TimeoutSendHandler(long maxTimeout, long minTimeout, Consumer eventConsumer) { - if (maxTimeout < minTimeout) { - throw new IllegalArgumentException("max timeout must be greater than min timeout"); - } - if (maxTimeout <= 0) { - throw new IllegalArgumentException("connectionTimeoutOnSend must be greater than zero"); - } - if (minTimeout <= 0) { - throw new IllegalArgumentException("minConnectionTimeoutOnSend must be greater than zero"); - } - this.maxTimeout = maxTimeout; - this.minTimeout = minTimeout; - this.eventConsumer = requireNonNull(eventConsumer, "event consumer"); - currentTimeout = maxTimeout; - } - - public void getWithTimeout(Future future) throws ExecutionException, InterruptedException, TimeoutException { - try { - long timeout = getCurrentTimeout(); - - future.get(timeout, TimeUnit.MILLISECONDS); - - int attempts; - lock.writeLock().lock(); - try { - attempts = this.attempts; - this.attempts = 0; - currentTimeout = maxTimeout; - } finally { - lock.writeLock().unlock(); - } - if (attempts > 0) { - generateEvent(attempts); - } - } catch (ExecutionException | InterruptedException | TimeoutException ex) { - lock.writeLock().lock(); - try { - attempts += 1; - currentTimeout = Math.max(minTimeout, currentTimeout / 2); - } finally { - lock.writeLock().unlock(); - } - throw ex; - } - } - - private void generateEvent(int attempts) { - eventConsumer.accept( - Event.start().endTimestamp() - .status(Event.Status.FAILED) - .name("Message sending attempt successful after " + attempts + " failed attempt(s)") - .type("MessageSendingAttempts") - ); - } - - public long getCurrentTimeout() { - lock.readLock().lock(); - try { - return currentTimeout; - } finally { - lock.readLock().unlock(); - } - } - - public long getDeadline() { - lock.readLock().lock(); - try { - return System.currentTimeMillis() + currentTimeout; - } finally { - lock.readLock().unlock(); - } - } - } } \ No newline at end of file From 90ac70a5913f8bb9adc658e8b41baaf844494f87 Mon Sep 17 00:00:00 2001 From: Oleg Date: Tue, 24 Oct 2023 10:18:25 +0400 Subject: [PATCH 7/8] Use dev release for tcp-dirty-core --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a0c4058..4d1d377 100644 --- a/build.gradle +++ b/build.gradle @@ -52,7 +52,7 @@ dependencies { } implementation "com.exactpro.th2:common-utils:2.2.0-dev" implementation 'com.exactpro.th2:netty-bytebuf-utils:0.0.1' - implementation 'com.exactpro.th2:conn-dirty-tcp-core:3.3.0-th2-5050-6611272114-703d0b2-SNAPSHOT' + implementation 'com.exactpro.th2:conn-dirty-tcp-core:3.3.0-dev' implementation 'com.exactpro.th2:grpc-lw-data-provider:2.2.0-dev' implementation 'org.slf4j:slf4j-api' From 76b2cdd6929972c7ceecc7b0066e319d3bb24eed Mon Sep 17 00:00:00 2001 From: Oleg Date: Tue, 24 Oct 2023 10:26:43 +0400 Subject: [PATCH 8/8] Update version and readme --- README.md | 9 ++++++++- gradle.properties | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8d43f35..b023e73 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,10 @@ This microservice allows sending and receiving messages via FIX protocol + *logoutOnIncorrectServerSequence* - whether to logout session when server send message with sequence number less than expected. If `false` then internal conn sequence will be reset to sequence number from server message. + *connectionTimeoutOnSend* - timeout in milliseconds for sending message from queue thread (please read about [acknowledgment timeout](https://www.rabbitmq.com/consumers.html#acknowledgement-timeout) to understand the problem). - _Default, 30000 mls._ + _Default, 30000 mls._ Each failed sending attempt decreases the timeout in half (but not less than _minConnectionTimeoutOnSend_). + The timeout is reset to the original value after a successful sending attempt. If connection is not established within the specified timeout an error will be reported. ++ *minConnectionTimeoutOnSend* - minimum value for the sending message timeout in milliseconds. _Default value is 1000 mls._ ### Security settings @@ -333,6 +335,11 @@ spec: # Changelog +## 1.5.0 + +* `minConnectionTimeoutOnSend` parameter is added. +* Sending timeout now decreases in half on each failed attempt (but not less than `minConnectionTimeoutOnSend`). + ## 1.4.2 * Ungraceful session disconnect support. * Removed NPE when session is reset by schedule. diff --git a/gradle.properties b/gradle.properties index 66a2be3..e60bbc1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1 @@ -release_version=1.4.2 \ No newline at end of file +release_version=1.5.0 \ No newline at end of file