diff --git a/receiver/solacereceiver/README.md b/receiver/solacereceiver/README.md index 7e1edd67b28a..20b12781858d 100644 --- a/receiver/solacereceiver/README.md +++ b/receiver/solacereceiver/README.md @@ -19,7 +19,7 @@ To get started with the Solace receiver, a telemetry queue and authentication de ```yaml receivers: solace: - broker: [localhost:5671] + broker: localhost:5671 auth: sasl_plain: username: otel @@ -63,7 +63,7 @@ Simple single node configuration with SASL plain authentication (TLS enabled by ```yaml receivers: solace: - broker: [localhost:5671] + broker: localhost:5671 auth: sasl_plain: username: otel @@ -80,7 +80,7 @@ High availability setup with SASL plain authentication (TLS enabled by default) ```yaml receivers: solace/primary: - broker: [myHost-primary:5671] + broker: myHost-primary:5671 auth: sasl_plain: username: otel @@ -88,7 +88,7 @@ receivers: queue: queue://#telemetry-profile123 solace/backup: - broker: [myHost-backup:5671] + broker: myHost-backup:5671 auth: sasl_plain: username: otel diff --git a/receiver/solacereceiver/config.go b/receiver/solacereceiver/config.go index e8eaffa48894..fae649cf6677 100644 --- a/receiver/solacereceiver/config.go +++ b/receiver/solacereceiver/config.go @@ -28,8 +28,8 @@ var ( // Config defines configuration for Solace receiver. type Config struct { - // The list of solace brokers (default localhost:5671) - Broker []string `mapstructure:"broker"` + // The solace broker (default localhost:5671) + Broker string `mapstructure:"broker"` // The name of the solace queue to consume from, it is required parameter Queue string `mapstructure:"queue"` diff --git a/receiver/solacereceiver/config_test.go b/receiver/solacereceiver/config_test.go index e0169e79c27d..da8b50ec4f19 100644 --- a/receiver/solacereceiver/config_test.go +++ b/receiver/solacereceiver/config_test.go @@ -31,7 +31,7 @@ func TestLoadConfig(t *testing.T) { { id: component.NewIDWithName(metadata.Type, "primary"), expected: &Config{ - Broker: []string{"myHost:5671"}, + Broker: "myHost:5671", Auth: Authentication{ PlainText: &SaslPlainTextConfig{ Username: "otel", diff --git a/receiver/solacereceiver/factory.go b/receiver/solacereceiver/factory.go index f0d59e55802f..07bfdb5c2449 100644 --- a/receiver/solacereceiver/factory.go +++ b/receiver/solacereceiver/factory.go @@ -35,7 +35,7 @@ func NewFactory() receiver.Factory { // createDefaultConfig creates the default configuration for receiver. func createDefaultConfig() component.Config { return &Config{ - Broker: []string{defaultHost}, + Broker: defaultHost, MaxUnacked: defaultMaxUnaked, Auth: Authentication{}, TLS: configtls.ClientConfig{ diff --git a/receiver/solacereceiver/messaging_service.go b/receiver/solacereceiver/messaging_service.go index d1903e3e5031..76ddbf0ef9e3 100644 --- a/receiver/solacereceiver/messaging_service.go +++ b/receiver/solacereceiver/messaging_service.go @@ -42,13 +42,12 @@ func newAMQPMessagingServiceFactory(cfg *Config, logger *zap.Logger) (messagingS return nil, err } - broker := cfg.Broker[0] // If the TLS config is nil, insecure is true and we should use amqp rather than amqps scheme := "amqp" if loadedTLSConfig != nil { scheme = "amqps" } - amqpHostAddress := fmt.Sprintf("%s://%s", scheme, broker) + amqpHostAddress := fmt.Sprintf("%s://%s", scheme, cfg.Broker) connectConfig := &amqpConnectConfig{ addr: amqpHostAddress, diff --git a/receiver/solacereceiver/messaging_service_test.go b/receiver/solacereceiver/messaging_service_test.go index 6faa2d559897..37bb1d099e50 100644 --- a/receiver/solacereceiver/messaging_service_test.go +++ b/receiver/solacereceiver/messaging_service_test.go @@ -86,7 +86,7 @@ func TestNewAMQPMessagingServiceFactory(t *testing.T) { cfg: &Config{ // no password Auth: Authentication{PlainText: &SaslPlainTextConfig{Username: "set"}}, TLS: configtls.ClientConfig{Insecure: false, InsecureSkipVerify: false}, - Broker: []string{broker}, + Broker: broker, Queue: queue, MaxUnacked: maxUnacked, }, @@ -98,7 +98,7 @@ func TestNewAMQPMessagingServiceFactory(t *testing.T) { cfg: &Config{ // invalid to only provide a key file Auth: Authentication{PlainText: &SaslPlainTextConfig{Username: "user", Password: "password"}}, TLS: configtls.ClientConfig{Config: configtls.Config{KeyFile: "someKeyFile"}, Insecure: false}, - Broker: []string{broker}, + Broker: broker, Queue: queue, MaxUnacked: maxUnacked, }, @@ -110,7 +110,7 @@ func TestNewAMQPMessagingServiceFactory(t *testing.T) { cfg: &Config{ // invalid to only provide a key file Auth: Authentication{PlainText: &SaslPlainTextConfig{Username: "user", Password: "password"}}, TLS: configtls.ClientConfig{Insecure: false}, - Broker: []string{broker}, + Broker: broker, Queue: queue, MaxUnacked: maxUnacked, }, @@ -134,7 +134,7 @@ func TestNewAMQPMessagingServiceFactory(t *testing.T) { cfg: &Config{ // invalid to only provide a key file Auth: Authentication{PlainText: &SaslPlainTextConfig{Username: "user", Password: "password"}}, TLS: configtls.ClientConfig{Insecure: true}, - Broker: []string{broker}, + Broker: broker, Queue: queue, MaxUnacked: maxUnacked, }, diff --git a/receiver/solacereceiver/testdata/config.yaml b/receiver/solacereceiver/testdata/config.yaml index 3935d3d5aa4d..c2e09112b711 100644 --- a/receiver/solacereceiver/testdata/config.yaml +++ b/receiver/solacereceiver/testdata/config.yaml @@ -1,5 +1,5 @@ solace/primary: - broker: [ myHost:5671 ] + broker: myHost:5671 auth: sasl_plain: username: otel @@ -20,12 +20,12 @@ solace/backup: insecure: true solace/noqueue: - broker: [ myHost:5671 ] + broker: myHost:5671 auth: sasl_plain: username: otel password: otel01 solace/noauth: - broker: [ myHost:5671 ] + broker: myHost:5671 queue: queue://#trace-profile123