rabbitmq / rabbitmq-stream-go-client

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

Force localhost when lookup the metadata #317

Closed Gsantomaggio closed 4 months ago

Gsantomaggio commented 4 months ago

Fixes https://github.com/rabbitmq/rabbitmq-stream-go-client/issues/315 in case it can't lookup the DNS name

Force to use localhost when the client connection when the locator is localhost but the node-name can be resolved.

dengliu commented 4 months ago

Hi @Gsantomaggio

First of all, thanks for this fix. I want to check if there is any value or config I need to set when creating a consumer. I got the follow error when I run getting_started.go from my local laptop with kubectl port-forward --namespace rabbitmq svc/rabbitmq 5552:5552 trying to access a RMQ deployed to k8s.

The failure happened when it tried to create the consumer from this line: https://github.com/rabbitmq/rabbitmq-stream-go-client/blob/main/examples/getting_started.go#L102-L109

  lookup rabbitmq-0.rabbitmq-headless.rabbitmq.svc.cluster.local: no such host Exiting.

The client version I used is github.com/rabbitmq/rabbitmq-stream-go-client v1.4.6

dengliu commented 4 months ago

Oh, NMV, i see your solution in another thread. Thanks a lot! https://github.com/rabbitmq/rabbitmq-stream-go-client/issues/315#issuecomment-2171693919