eolivelli commented on a change in pull request #13470:
URL: https://github.com/apache/pulsar/pull/13470#discussion_r785399892



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractDispatcherMultipleConsumers.java
##########
@@ -239,5 +239,24 @@ private int getFirstConsumerIndexOfPriority(int 
targetPriority) {
 
     private static final Logger log = 
LoggerFactory.getLogger(PersistentStickyKeyDispatcherMultipleConsumers.class);
 
+    public StickyKeyConsumerSelector 
createConsumerSelectorInstance(ServiceConfiguration conf) {
+        try {
+            Class<?> consumerSelectorClass = 
Class.forName(conf.getKeySharedConsumerSelectorStrategy());
+            Object consumerSelectorClassInstance = 
consumerSelectorClass.getDeclaredConstructor().newInstance();
+            if (consumerSelectorClassInstance instanceof 
StickyKeyConsumerSelector) {
+                return (StickyKeyConsumerSelector) 
consumerSelectorClassInstance;
+            } else {
+                log.error("create key shared consumer selector strategy 
failed."

Review comment:
       We cannot fallback to another algorithm otherwise the system will break 
as all the assumptions in the application won't be guaranteed.
   
   Let's throw a bad error here and in other failure cases




-- 
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]


Reply via email to