rabbitmq / rabbitmq-stream-go-client

A client library for RabbitMQ streams
MIT License
170 stars 20 forks source link

lookup rabbitmq: no such host #315

Closed libracoder closed 5 months ago

libracoder commented 5 months ago

Describe the bug

I am using this simple example to test the implementation of streams in my application , I have been testing this for days to no avail

func main() {
    env, err := stream.NewEnvironment(
        stream.NewEnvironmentOptions().
            SetHost("65.108.84.***").
            SetPort(5552).
            SetUser("root").
            SetPassword("***"))
    CheckErrSend(err)

    streamName := "hello"
    err = env.DeclareStream(streamName,
        &stream.StreamOptions{
            MaxLengthBytes: stream.ByteCapacity{}.GB(2),
        },
    )
    CheckErrSend(err)

    _, err = env.NewProducer(streamName, stream.NewProducerOptions())
    CheckErrSend(err)

I repeatedly get errors

lookup rabbitmq: no such host

The, I have enabled rabbitmq-streams using the plugin, The stream is also getting created. This is the line that fails _, err = env.NewProducer(streamName, stream.NewProducerOptions())

image

Reproduction steps

  1. Create a main.go file
  2. copy the code above and paste
  3. Test ...

Expected behavior

Throws the lookup rabbitmq: no such host error

Additional context

No response

Gsantomaggio commented 5 months ago

Hi @libracoder If the node is behind a load-balancer/proxy/public IP you need to use the load-balancer configuration, see: https://github.com/rabbitmq/rabbitmq-stream-go-client?tab=readme-ov-file#load-balancer

Gsantomaggio commented 5 months ago

@libracoder Can you try https://github.com/rabbitmq/rabbitmq-stream-go-client/pull/317 ?