lhotari commented on code in PR #23449:
URL: https://github.com/apache/pulsar/pull/23449#discussion_r1799874725
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java:
##########
@@ -310,6 +310,19 @@ private CompletableFuture<Void>
addConsumerInternal(Consumer consumer) {
if (consumer.subType() != dispatcher.getType()) {
return FutureUtil.failedFuture(
new SubscriptionBusyException("Subscription is
of different type"));
+ } else if (dispatcher.getType() == SubType.Key_Shared) {
+ KeySharedMeta dispatcherKsm =
dispatcher.getConsumers().get(0).getKeySharedMeta();
+ KeySharedMeta consumerKsm =
consumer.getKeySharedMeta();
+ if (dispatcherKsm.getKeySharedMode() !=
consumerKsm.getKeySharedMode()) {
+ return FutureUtil.failedFuture(
+ new
SubscriptionBusyException("Subscription is of different key_shared mode"));
+ }
+ if (dispatcherKsm.isAllowOutOfOrderDelivery() !=
consumerKsm.isAllowOutOfOrderDelivery()) {
+ return FutureUtil.failedFuture(
+ new
SubscriptionBusyException(dispatcherKsm.isAllowOutOfOrderDelivery()
+ ? "Subscription allows out of
order delivery" :
+ "Subscription does not allow out
of order delivery"));
Review Comment:
@pdolif great work. I added a suggestion for reducing the duplication.
--
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]