rabbitmq-stream-rust-client icon indicating copy to clipboard operation
rabbitmq-stream-rust-client copied to clipboard

Bug/Doc: Producer connection refused if not using `.load_balancer_mode(true)`

Open chevdor opened this issue 1 year ago • 3 comments

Describe the bug

This is probably more an information to add to the doc/examples than a bug per say. A hint in the error message could also save some time :)

I am hosting a RabbitMQ instance in K8s, not using a LoadBalancer but using Traefik. Running a consumer with:

	let environment = Environment::builder()
		.host("rabbitmq.sample.org")
		.username("user")
		.password("pass")
		// .port(5552)
		.build()
		.await?;

works fine.

Running a producer with the same:

	let environment = Environment::builder()
		.host("rabbitmq.sample.org")
		.username("user")
		.password("pass")
		// .port(5552)
		.build()
		.await?;

fails with: Error: Client(Io(Os { code: 61, kind: ConnectionRefused, message: "Connection refused" }))

The producer however does connect sucessfully when using:

	let environment = Environment::builder()
		.host("rabbitmq.sample.org")
		.username("user")
		.password("pass")
		.load_balancer_mode(true)                        // REQUIRED
		// .port(5552)
		.build()
		.await?;

Reproduction steps

see above

Expected behavior

Hint in the doc/error message about .load_balancer(). I did not find any other mention other than this PR.

Additional context

No response

chevdor avatar Sep 20 '24 08:09 chevdor