diff --git a/adapter/internal/messaging/connection.go b/adapter/internal/messaging/connection.go index 6a2d87e8d3..7fed17c716 100644 --- a/adapter/internal/messaging/connection.go +++ b/adapter/internal/messaging/connection.go @@ -72,9 +72,10 @@ func connectionRetry(key string) (*Consumer, *amqp.Connection, error) { retryInterval = 10 * time.Second } logger.LoggerMsg.Infof("Retrying to connect with %s in every %d seconds until exceed %d attempts", - amqpURIArray[j].url, retryInterval, maxAttempt) + amqpURIArray[j].url, amqpURIArray[j].connectionDelay, maxAttempt) for i := 1; i <= maxAttempt; i++ { + rabbitConn, err = amqp.Dial(amqpURIArray[j].url + "/") if err == nil { if key != "" && len(key) > 0 { @@ -85,6 +86,13 @@ func connectionRetry(key string) (*Consumer, *amqp.Connection, error) { } return nil, rabbitConn, nil } + + if key != "" && len(key) > 0 { + logger.LoggerMsg.Infof("Retry attempt %d for the %s to connect with topic %s has failed. Retrying after %d seconds", i, + amqpURIArray[j].url, key, amqpURIArray[j].connectionDelay) + } else { + logger.LoggerMsg.Infof("Retry attempt %d for the %s has failed. Retrying after %d seconds", i, amqpURIArray[j].url, amqpURIArray[j].connectionDelay) + } time.Sleep(retryInterval) } if i == maxAttempt {