You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/01/29 12:24:10 UTC
[GitHub] [pulsar] RobertIndie commented on a change in pull request #13355: [PIP-124] Create init subscription before sending message to DLQ
RobertIndie commented on a change in pull request #13355:
URL: https://github.com/apache/pulsar/pull/13355#discussion_r795046861
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -1236,7 +1238,30 @@ protected void handleProducer(final CommandProducer cmdProducer) {
});
schemaVersionFuture.thenAccept(schemaVersion -> {
- topic.checkIfTransactionBufferRecoverCompletely(isTxnEnabled).thenAccept(future -> {
+ topic.checkIfTransactionBufferRecoverCompletely(isTxnEnabled).thenCompose(future -> {
+ if (Strings.isNullOrEmpty(initialSubscriptionName)
+ || topic.getSubscriptions().containsKey(initialSubscriptionName)
+ || !topic.isPersistent()) {
+ return CompletableFuture.completedFuture(null);
+ }
+ return isTopicOperationAllowed(
+ topicName, TopicOperation.SUBSCRIBE
+ ).thenCompose(canSubscribe -> {
+ if (!canSubscribe) {
+ log.warn(
+ "[{}] Could not create the initial subscription {} for topic {}. Client "
+ + "is not authorized to subscribe with role {}",
+ remoteAddress, initialSubscriptionName, topicName, getPrincipal());
+ return CompletableFuture.completedFuture(null);
Review comment:
I added the `ProducerInitSubAuthorizationException` to handle this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org