pulsar-rs icon indicating copy to clipboard operation
pulsar-rs copied to clipboard

Library always connect to 127.0.0.1?

Open kuangyechen opened this issue 2 years ago • 5 comments

Here's my code

let builder = Pulsar::builder(pulsar_url.clone(), TokioExecutor);
let mut producer = builder
    .build()
    .await?
    .producer()
    .with_topic(topic.clone())
    .with_name(name.clone())
    .build()
    .await?;

And I set log level to info.

2023-01-29T14:39:57.021731Z  INFO pulsar::connection_manager: Connected n°74724553-10f4-4c72-a116-56b2a89fa99e to pulsar://xxxxx.com:6650 in 429ms       
2023-01-29T14:39:58.510769Z  WARN pulsar::connection: retry establish connection on: [Io(Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })] 
2023-01-29T14:39:58.512297Z ERROR pulsar::connection_manager: connection error, retrying connection to pulsar://127.0.0.1:6650 after 100ms                          
2023-01-29T14:39:58.614264Z  WARN pulsar::connection: retry establish connection on: [Io(Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })] 

Which connects to localhost even if I set url to a remote host.

kuangyechen avatar Jan 29 '23 14:01 kuangyechen

There's no logic in the library to set different URLs. You can share more info, especially what the URL you configured is.

tisonkun avatar Jan 29 '23 15:01 tisonkun

In addition, generally connected logged after retries. So it looks like you have multiple connections.

tisonkun avatar Jan 29 '23 15:01 tisonkun

cc @CleverAkanoa since you're working on reconnection recently.

tisonkun avatar Jan 29 '23 15:01 tisonkun

There's no logic in the library to set different URLs. You can share more info, especially what the URL you configured is.

The url I used is just "pulsar://xxxxx.com:6650". Than I got errors trying to connect to 127.0.0.1. When I try on the server running pulsar, this code will work, but there will also be two connection logs.

kuangyechen avatar Jan 29 '23 15:01 kuangyechen

any updates for this?

HasanHaghniya avatar Jun 25 '24 16:06 HasanHaghniya