From 68025330e2537b12a701a1d92b4edd226cb70822 Mon Sep 17 00:00:00 2001 From: Oleg Date: Fri, 13 Oct 2023 17:50:24 +0400 Subject: [PATCH] Use long min value as a marker for unset sequence --- .../schema/message/impl/rabbitmq/transport/MessageId.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/MessageId.kt b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/MessageId.kt index e15d9f339..5bd43a5d6 100644 --- a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/MessageId.kt +++ b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/MessageId.kt @@ -90,7 +90,7 @@ data class MessageId( } -private const val SEQUENCE_NOT_SET = -1L +private const val SEQUENCE_NOT_SET = Long.MIN_VALUE private class MessageIdBuilderImpl : MessageId.Builder { private var _sessionAlias: String? = null @@ -128,7 +128,7 @@ private class MessageIdBuilderImpl : MessageId.Builder { override fun isDirectionSet(): Boolean = _direction != null override fun setSequence(sequence: Long): MessageId.Builder = apply { - require(sequence > SEQUENCE_NOT_SET) { "Property \"sequence\" should not be negative" } + require(sequence != SEQUENCE_NOT_SET) { "Value $sequence for property \"sequence\" is reserved" } this._sequence = sequence }