pulsar-rs
pulsar-rs copied to clipboard
Connection Loss During Consumer Poll
If a consumer's connection becomes unusable while it is polling for new messages, how is this handled? Should there be a seamless reconnect? Does it use the same connection retry options that are used when the initial connection attempt fails?
It seems there are reconnect operations both when creating a consumer in TopicConsumer::new and consuming messages after ConsumerEngine started , but there's no retry when consuming messages, if reconnect fails in engine, the loop in engine method will stop.
FYI I'm in the process of fixing issues around that, the next version should be more stable
As a workaround, I've used this:
info!("Starting the consumer loop");
loop {
let mut consumer = libpulsar::new_consumer::<VideoEvent>(&pulsar_conn, &topic).await?;
info!("Consumer started");
let e = consumer_loop(consumer).await;
warn!("Consumer was closed because of {:?}, restarting it...", e);
}