-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid enable DLQ on Key_Shared subscription. #9163
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MarvinCai We also need to add verification in the ConsumerBuilder. With the ConsumerBuilder, users should get a PulsarClient exception if they want to enable DLQ on a Key_Shared subscription.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same logic exists in the void messageReceived method. Is it better for us to prohibit setting this kind of policy in the builder ?
if (deadLetterPolicy != null && possibleSendToDeadLetterTopicMessages != null && redeliveryCount >= deadLetterPolicy.getMaxRedeliverCount()) {
possibleSendToDeadLetterTopicMessages.put((MessageIdImpl)message.getMessageId(), Collections.singletonList(message));
}
There is retry logic in deadLetterPolicy
. If the number of retries is exceeded, how to deal with these messages? But the retryLetterProducer
in consumerImpl
doesn't seem to do any processing.
Added check in ConsumerBuilder to throw InvalidConfigurationException if set DeadLetterTopic name for KeyShared subType.
For first point, there's a check |
@315157973 @codelipenghui Can you review the PR again? |
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
Show resolved
Hide resolved
Now ConsumerImpl constructor will throw exception when client try to directly construct a Consumer with Key_Shared subscription type and DeadLetterTopic. Same to all subclass like ZeroQueueCosumer, RawReader...., this shouldn't affect existing logic using ConsumerBuilder to create consumer as builder will check and make sure there's no DLQ set for Key_Shared sub type. |
/pulsarbot run-failure-checks |
3 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
2 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
This reverts commit 9af8577.
Fixes #9156
Motivation
In Pulsar, DLQ only supports non-ordered subscriptions, But now the Key_Shared subscription also allowed enable DLQ.
Should avoid enable DLQ on the Key_Shared subscription tpye.
Modifications
Only send message to DLQ if not Key_Shared subscription type.
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation