-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Broker] Check allowAutoSubscriptionCreation when creating init sub
#14458
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
Changes from all commits
aba7060
0203df5
5b349b9
7e9a9e7
6351f5b
71a5d2c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1273,6 +1273,20 @@ protected void handleProducer(final CommandProducer cmdProducer) { | |
| if (!Strings.isNullOrEmpty(initialSubscriptionName) | ||
| && topic.isPersistent() | ||
| && !topic.getSubscriptions().containsKey(initialSubscriptionName)) { | ||
| if (!this.getBrokerService().isAllowAutoSubscriptionCreation(topicName)) { | ||
| String msg = | ||
| "Could not create the initial subscription due to the auto subscription " | ||
| + "creation is not allowed."; | ||
| if (producerFuture.completeExceptionally( | ||
| new BrokerServiceException.NotAllowedException(msg))) { | ||
| log.warn("[{}] {} initialSubscriptionName: {}, topic: {}", | ||
| remoteAddress, msg, initialSubscriptionName, topicName); | ||
| commandSender.sendErrorResponse(requestId, | ||
| ServerError.NotAllowedError, msg); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that the consequence of sending this
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's right. +1 |
||
| } | ||
| producers.remove(producerId, producerFuture); | ||
| return; | ||
| } | ||
| createInitSubFuture = | ||
| topic.createSubscription(initialSubscriptionName, InitialPosition.Earliest, | ||
| false); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.