apache / pulsar-client-python

Apache Pulsar Python client library
https://pulsar.apache.org/
Apache License 2.0
51 stars 40 forks source link

Disable consumer auto reconnect #219

Open fecet opened 1 month ago

fecet commented 1 month ago

Could you provide an option to set the client's automatic reconnection strategy? I would like to use the admin API to force delete a subscription, but currently, the consumer immediately reconnects after being disconnected, causing the subscription to be recreated.

per https://github.com/apache/pulsar/pull/22423

BewareMyPower commented 1 month ago

Currently not. Java client does not have the similar feature as well. You'd like to make the reconnection backoff configurable, right? So you can manually delay the first reconnection.

However, it would affect the normal case. For example, if you configured it as 5 seconds, then even if the connection was disconnected due to some network issues, the consumer still required 5 seconds to recover.

IMO, a good idea is to add a new field to the protocol that tells the clients not to reconnect within some time. You can also add a discussion for the feature in https://lists.apache.org/list.html?dev@pulsar.apache.org