From 444df1451216aa0cc4c288c19e01e1c87b682205 Mon Sep 17 00:00:00 2001 From: Adrian Dobrita Date: Fri, 9 Feb 2024 17:18:56 +0200 Subject: [PATCH] update fields --- cmd/connector/config/config.toml | 6 ++++-- config/config.go | 5 +++-- factory/wsConnectorFactory.go | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cmd/connector/config/config.toml b/cmd/connector/config/config.toml index 1531297..8073640 100644 --- a/cmd/connector/config/config.toml +++ b/cmd/connector/config/config.toml @@ -10,9 +10,11 @@ retry_duration = 5 # This flag specifies if we should send an acknowledge signal upon recieving data with_acknowledge = true + # The duration in seconds to wait for an acknowledgement message + acknowledge_timeout_in_sec = 5 # Signals if in case of data payload processing error, we should send the ack signal or not. If you want to block # incoming data in case of a local error, this should be set to true. blocking_ack_on_error = true # This flag specifies if we should drop messages if there is no connection to the host - dropMessagesIfNoConnection = false - Version = 1 + drop_messages_if_no_connection = false + version = 1 diff --git a/config/config.go b/config/config.go index 4df91f7..0f5b8d5 100644 --- a/config/config.go +++ b/config/config.go @@ -12,7 +12,8 @@ type WebSocketConfig struct { Mode string `toml:"mode"` RetryDuration uint32 `toml:"retry_duration"` WithAcknowledge bool `toml:"with_acknowledge"` + AcknowledgeTimeoutInSec int `toml:"acknowledge_timeout_in_sec"` BlockingAckOnError bool `toml:"blocking_ack_on_error"` - DropMessagesIfNoConnection bool // Set to `true` to drop messages if there is no active WebSocket connection to send to. - Version uint32 // Defines the payload version. + DropMessagesIfNoConnection bool `toml:"drop_messages_if_no_connection"` // Set to `true` to drop messages if there is no active WebSocket connection to send to. + Version uint32 `toml:"version"` // Defines the payload version. } diff --git a/factory/wsConnectorFactory.go b/factory/wsConnectorFactory.go index 1b8f9c2..ccffbd7 100644 --- a/factory/wsConnectorFactory.go +++ b/factory/wsConnectorFactory.go @@ -10,6 +10,7 @@ import ( "github.com/multiversx/mx-chain-core-go/marshal" "github.com/multiversx/mx-chain-core-go/marshal/factory" logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-chain-ws-connector-template-go/config" "github.com/multiversx/mx-chain-ws-connector-template-go/process" ) @@ -79,6 +80,8 @@ func createWsHost(wsMarshaller marshal.Marshalizer, cfg config.WebSocketConfig) RetryDurationInSec: int(cfg.RetryDuration), BlockingAckOnError: cfg.BlockingAckOnError, DropMessagesIfNoConnection: false, + AcknowledgeTimeoutInSec: cfg.AcknowledgeTimeoutInSec, + Version: cfg.Version, }, Marshaller: wsMarshaller, Log: log,