Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
chevdor opened this issue Sep 20, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@chevdor
Copy link

chevdor commented Sep 20, 2024

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 chevdor added the bug Something isn't working label Sep 20, 2024
@JiaYingZhang
Copy link
Contributor

sry, I implemented it. Have you solved this problem? I never used Traefik, could you provide more information?
@chevdor

@chevdor
Copy link
Author

chevdor commented Jan 22, 2025

I have solved the problem using .load_balancer_mode(true), the issues actually were that:

  • it was not very documented and it took some digging into the code to find this .load_balancer_mode(true)
  • the behavior of using .load_balancer_mode(true) and what it does was rather unclear to me
  • since I am not using a load balancer (but you may consider that Traefik counts as such), it did not jump at me that using .load_balancer_mode(true) was key to solving the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants