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

Handle producer build for another port than 5552

Open Walfal opened this issue 1 year ago • 1 comments

Describe the bug

Hi,

If I set another port than 5552 on rabbitmq environment, eg. 5000, the producer builder panics. It prints a connection refused on the build(stream): Client(Io(Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }))

It seems even if the environment contains the port 5000, the builder of the producer (it's not the case for the consumer) want to connect itself with the port 5552.

We need to give anothe port than 5552 because we run integrations tests in parallel with testcontainer

Reproduction steps

  1. Launch rabbitmq with another port than 5552 for the current computer: docker run -it --rm --name rabbitmq -p 5000:5552 -p 15672:15672 -p 5672:5672 \ -e RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS='-rabbitmq_stream advertised_host localhost' \ -e RABBITMQ_USER='user' -e RABBITMQ_PASSWORD='password' \ rabbitmq:3.13

  2. Set 5000 in the environment building it like this: let env = Environment::builder().port(5000).build().await.unwrap(); Or even if putting 5000 in the default Environments variables

  3. Try to build the producer: let mut producer = env.env.producer().name(&reference).build(&env.stream).await.unwrap();

This panics on the unwrap() due to this error: Client(Io(Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }))

Expected behavior

The expected behavior would be to handle customs ports, building the producer with a given port in the Environment.

Additional context

No response

Walfal avatar Jul 09 '24 07:07 Walfal