Skip to main content

RabbitMQ Streams - No such host is known

Yesterday I talked about RabbitMQ Streams, a new persistent and replicated data structure in RabbitMQ 3.9 which models an append-only log with non-destructive consumer semantics.

I demonstrated how you could build a small example application in C# to test this stream. I first tried this code against a local cluster I had running in a docker container (check my repo if you want a Dockerfile where this plugin is already enabled: https://github.com/wullemsb/docker-rabbitmq).

At first this failed with the following error message:

System.Net.Sockets.SocketException: No such host is known

In my configuration you can see that I’m pointing to the local Loopback address which should be localhost:

Let’s open the debugger and see what is going on…

When I looked at the connection settings I noticed the following:

You can see that the advertised host is not ‘localhost’ but a random string.

This is the random name assigned to the node in my cluster.

To get rid of this problem, I have to start the docker container with an extra argument to set the node name to localhost:

RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS="-rabbitmq_stream advertised_host localhost"