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:
Thanks. 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]