Skip to content

When topic is terminated. Client must not retry connecting to broker. - #1128

Merged
RobertIndie merged 1 commit into
apache:masterfrom
pkumar-singh:support_topic_termination
Nov 16, 2023
Merged

RobertIndie merged 1 commit into
apache:masterfrom
pkumar-singh:support_topic_termination

Conversation

@pkumar-singh

Copy link
Copy Markdown
Member

Motivation

GoLang Pulsar client library has no support for Topic termination.
When a topic is terminated following should happen at client library side.

  1. Producers should stop reconnecting. As once topic is terminated, it is permanent.
  2. All the pending messages should be failed.

Modifications

If reconnect is failing with TopicTerminated error.
Run through the pending messages queue and complete the callback.
After that exit the reconnect loop and set producer state as closing.
Marking producer state producerClosing will ensure that new messages are immediately failed.

Comment thread pulsar/producer_partition.go Resolved
@pkumar-singh
pkumar-singh force-pushed the support_topic_termination branch from 21d9b7b to 7692e27 Compare November 14, 2023 17:52

@RobertIndie RobertIndie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some tests to verify it?

@pkumar-singh
pkumar-singh force-pushed the support_topic_termination branch from 7692e27 to 71d01d5 Compare November 15, 2023 20:45
@pkumar-singh
pkumar-singh force-pushed the support_topic_termination branch from 71d01d5 to e5e501a Compare November 15, 2023 20:47
@pkumar-singh

Copy link
Copy Markdown
Member Author

Could you add some tests to verify it?

Done.!

@RobertIndie RobertIndie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@RobertIndie
RobertIndie merged commit ec846ff into apache:master Nov 16, 2023
@RobertIndie RobertIndie added this to the v0.12.0 milestone Nov 16, 2023
pkumar-singh added a commit to pkumar-singh/pulsar-client-go that referenced this pull request Nov 21, 2023
…ding messages should be failed (apache#1128)

GoLang Pulsar client library has no support for Topic termination.
When a topic is terminated following should happen at client library side.
1. Producers should stop reconnecting. As once topic is terminated, it is permanent.
2. All the pending messages should be failed.

If reconnect is failing with TopicTerminated error.
Run through the pending messages queue and complete the callback.
After that exit the reconnect loop and set producer state as closing.
Marking producer state producerClosing will ensure that new messages are immediately failed.

Co-authored-by: Prashant Kumar <[email protected]>
RobertIndie pushed a commit that referenced this pull request Dec 8, 2023
…uotaExceededException/ProducerFenced when reconnecting (#1134)

Master Issue: #1128

### Motivation

In Java client, when we get TopicNotFound/TopicTerminated/ProducerBlockedQuotaExceededException/ProducerFenced, we should failPendingMessages, and close producer. But in Go client, we forget to handle ProducerBlockedQuotaExceededException/ProducerFenced, and in #1128, we just call sr.done(), actually we should call failPendingMessages().

https://github.com/apache/pulsar-client-go/pull/1128/files
https://github.com/apache/pulsar/blob/master/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java#L1663

### Modifications
1. rename `errMsgTopicNotFount` to `errMsgTopicNotFound`
2. handle TopicTerminated/ProducerBlockedQuotaExceededException/ProducerFenced, call `failPendingMessages()`;

---------

Co-authored-by: gunli <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants