-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[PIP-124] Create init subscription before sending message to DLQ #13355
Conversation
Motivation If we enable the DLQ when consuming messages. For some messages that can't be processed successfully, the messages will be moved to the DLQ, but if we do not specify the data retention for the namespace or create a subscription for the DLQ to retain the data, the data of the DLQ topic will be removed automatically. Therefore, we need to create the initial subscription before sending messages to the DLQ. Modification * Add `initSubscriptionName` and `initSubscriptionType` to the `DeadLetterPolicy` * Create the initial subscription before creating the deadLetterProducer in ConsumerImpl. Signed-off-by: Zike Yang <ar@armail.top>
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
Outdated
Show resolved
Hide resolved
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/DeadLetterPolicy.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/client/api/DeadLetterTopicTest.java
Show resolved
Hide resolved
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/DeadLetterPolicy.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Zike Yang <zkyang@streamnative.io>
Signed-off-by: Zike Yang <zkyang@streamnative.io>
Signed-off-by: Zike Yang <zkyang@streamnative.io>
Signed-off-by: Zike Yang <zkyang@streamnative.io>
Signed-off-by: Zike Yang <zkyang@streamnative.io>
Motivation This PR is the doc for apache#13355 Modification * Add doc for init sub config in DLQ policy and producer Signed-off-by: Zike Yang <zkyang@streamnative.io>
/pulsarbot run-failure-checks |
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ProducerBuilder.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/client/api/AuthorizationProducerConsumerTest.java
Show resolved
Hide resolved
Signed-off-by: Zike Yang <zkyang@streamnative.io>
Signed-off-by: Zike Yang <zkyang@streamnative.io>
…xception Signed-off-by: Zike Yang <zkyang@streamnative.io>
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Zike Yang <zkyang@streamnative.io>
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Zike Yang <zkyang@streamnative.io>
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Zike Yang <zkyang@streamnative.io>
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
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.
LGTM
Signed-off-by: Zike Yang <zkyang@streamnative.io>
/pulsarbot run-failure-checks |
Motivation In apache#13355, we added support for creating initial subscription when creating the producer. But the broker didn't check if the subscription can be created automatically. The initial subscription will be created even if the `allowAutoSubscriptionCreation` is disabled. Modification * Check `allowAutoSubscriptionCreation` when creating the initial subscription. Signed-off-by: Zike Yang <zkyang@streamnative.io>
…#14458) Master Issue: #13408 ### Motivation In #13355, we added support for creating initial subscription when creating the producer. But the broker didn't check if the subscription can be created automatically. The initial subscription will be created even if the `allowAutoSubscriptionCreation` is disabled.
…#14458) Master Issue: #13408 ### Motivation In #13355, we added support for creating initial subscription when creating the producer. But the broker didn't check if the subscription can be created automatically. The initial subscription will be created even if the `allowAutoSubscriptionCreation` is disabled. (cherry picked from commit db25438)
…che#13355) * fix(Client): Create init subscription while creating DLQ producer Motivation If we enable the DLQ when consuming messages. For some messages that can't be processed successfully, the messages will be moved to the DLQ, but if we do not specify the data retention for the namespace or create a subscription for the DLQ to retain the data, the data of the DLQ topic will be removed automatically. Therefore, we need to create the initial subscription before sending messages to the DLQ. Modification * Add `initSubscriptionName` and `initSubscriptionType` to the `DeadLetterPolicy` * Create the initial subscription before creating the deadLetterProducer in ConsumerImpl. Signed-off-by: Zike Yang <zkyang@streamnative.io>
…apache#14458) Master Issue: apache#13408 ### Motivation In apache#13355, we added support for creating initial subscription when creating the producer. But the broker didn't check if the subscription can be created automatically. The initial subscription will be created even if the `allowAutoSubscriptionCreation` is disabled.
What was the purpose of commit 0f202b5 "Make initialSubscriptionName internal"? |
Exposing the |
Fix #13408
Motivation
If we enable the DLQ when consuming messages. For some messages that can't be processed successfully, the messages will be moved to the DLQ, but if we do not specify the data retention for the namespace or create a subscription for the DLQ to retain the data, the data of the DLQ will be removed automatically. Therefore, we need to create the initial subscription before sending messages to the DLQ.
Modifications
When the deadLetterProducer is initialized, the consumer will set the initial subscription of the deadLetterProducer according to the DeadLetterPolicy.
When the broker creates a producer(after receiving the CommandProducer), if it finds that the topic does not exist, it will not only create the topic(if the topic automatically creation is enabled) but also create the initial subscription(if the initial subscription name is set). When creating an initial subscription, the user needs to have the
canConsume
permission and theallowAutoSubscriptionCreation
needs to be enabled.Verifying this change
This change is already covered by existing tests, such as
testPermissionForProducerCreateInitialSubscription
testDeadLetterTopicWithInitialSubscription
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation
Check the box below and label this PR (if you have committer privilege).
Need to update docs?
doc-required