Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions pkg/rabbitmq/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package rabbitmq

import (
"errors"
"fmt"
"io"
"sync"
"time"
Expand All @@ -40,9 +41,15 @@ type channelManager struct {

func newChannelManager(url string, conf *amqp.Config, maximumBackoff time.Duration) (*channelManager, error) {
log := logger.WithName("rabbitmq-channel-manager")
log.Info("attempting to connect to amqp server", "server", url)
uri, err := amqp.ParseURI(url)
if err != nil {
return nil, fmt.Errorf("invalid amqp connection string: %w", err)
}

conn, ch, err := getNewChannel(url, conf)
address := fmt.Sprintf("%s://%s:%d", uri.Scheme, uri.Host, uri.Port)
log.Info("attempting to connect to amqp server", "server", address)

conn, ch, err := getNewChannel(uri.String(), conf)
if err != nil {
return nil, err
}
Expand All @@ -57,7 +64,8 @@ func newChannelManager(url string, conf *amqp.Config, maximumBackoff time.Durati
maximumBackoff: maximumBackoff,
}
go chManager.startNotifyCancelOrClosed()
log.Info("connected to amqp server!", "url", url)

log.Info("connected to amqp server", "url", address)

return &chManager, nil
}
Expand Down