pulsar-client-go icon indicating copy to clipboard operation
pulsar-client-go copied to clipboard

MaxReconnectToBroker is useless for consumer

Open omnilight opened this issue 4 years ago • 7 comments

Expected behavior

When we set ConsumerOptions.MaxReconnectToBroker to some value other than infinite, then when reconnection count reaches this value consumer should return with an error.

Actual behavior

Consumer just stuck, because reconnectToBroker just exists leaving consumer useless

Steps to reproduce

  1. Set option to ConsumerOptions.MaxReconnectToBroker = 2
  2. Begin consuming messages
  3. Do something with broker (say, stop it)
  4. Messages would stop consuming
  5. Start broker
  6. Messages won't appear because consumer would not reconnect

System configuration

Pulsar version: 2.7

omnilight avatar Mar 27 '21 19:03 omnilight

Added pull request with fix

omnilight avatar Mar 28 '21 10:03 omnilight

I think this is what MaxReconnectToBroker means, it won't try to reconnect to broker after given MaxReconnectToBroker tries. 😄 By the way, we do need to close useless consumer when we are not trying to reconnect to broker.

jonyhy96 avatar Mar 31 '21 08:03 jonyhy96

Yes, but in the case it stops reconnecting consumer will just stuck and no notification would be passed to the caller. In the pr I've added closing consumer in this case. For me that seems valid behaviour

omnilight avatar Mar 31 '21 10:03 omnilight

@wolfstudy Hi! Sorry for direct mention, but could we proceed with this issue in any way?

omnilight avatar Apr 07 '21 13:04 omnilight

@wolfstudy Hi! Sorry for direct mention, but could we proceed with this issue in any way?

Thanks @omnilight work for this, agree with you.

wolfstudy avatar Jun 02 '21 03:06 wolfstudy

Are there any plans for this PR to be included in a release at some point? We're suffering a little bit from this bug :)

@wolfstudy friendly ping

barbashov avatar Mar 05 '22 13:03 barbashov

@wolfstudy any updates on that please? We struggle with that behavior

barbashov avatar Dec 26 '22 13:12 barbashov