gnodet commented on code in PR #31341:
URL: https://github.com/apache/camel/pull/31341#discussion_r4798434603


##########
components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarConfiguration.java:
##########
@@ -169,11 +170,11 @@ public class PulsarConfiguration implements Cloneable {
               description = "The number of threads that receive and process 
the messages of each consumer, when "
                             + "messageListener is disabled.")
     private int numberOfConsumerThreads = 1;
-    @UriParam(label = "consumer", enums = "AUTO_SPLIT,STICKY",
+    @UriParam(label = "consumer", enums = "AUTO_SPLIT",
               description = "The key shared policy of the consumers, for the 
KEY_SHARED subscription type. AUTO_SPLIT has "
-                            + "the broker split the hash range of the message 
keys over the consumers. STICKY needs hash "
-                            + "ranges assigned to each consumer, which Camel 
does not set, so the Pulsar client rejects it and "
-                            + "the consumer fails to start.")
+                            + "the broker split the hash range of the message 
keys over the consumers. The STICKY policy of "
+                            + "the Pulsar client needs hash ranges assigned to 
each consumer, which Camel does not set, so it "
+                            + "is not supported.")

Review Comment:
   The description for `keySharedPolicy` now only lists AUTO_SPLIT in the enum 
but still describes STICKY in the description text. Consider simplifying to 
just describe AUTO_SPLIT behavior:
   
   ```suggestion
                 description = "The key shared policy of the consumers, for the 
KEY_SHARED subscription type. AUTO_SPLIT has " +
                               "the broker split the hash range of the message 
keys over the consumers.")
   ```



##########
components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/utils/consumers/CommonCreationStrategyImpl.java:
##########
@@ -84,11 +84,12 @@ protected static ConsumerBuilder<byte[]> getBuilder(
         if (endpointConfiguration.getKeySharedPolicy() != null) {
             if 
("AUTO_SPLIT".equalsIgnoreCase(endpointConfiguration.getKeySharedPolicy())) {
                 builder.keySharedPolicy(KeySharedPolicy.autoSplitHashRange());
-            } else if 
("STICKY".equalsIgnoreCase(endpointConfiguration.getKeySharedPolicy())) {
-                builder.keySharedPolicy(KeySharedPolicy.stickyHashRange());
             } else {
+                // STICKY needs the hash ranges of each consumer, which Camel 
cannot set, so the Pulsar client would
+                // reject it with "Ranges for KeyShared policy must not be 
empty"
                 throw new IllegalArgumentException(
-                        "Unsupported KeySharedPolicy: " + 
endpointConfiguration.getKeySharedPolicy());
+                        "Unsupported keySharedPolicy: " + 
endpointConfiguration.getKeySharedPolicy()

Review Comment:
   The error message could be more specific about what is actually supported. 
Consider:
   
   ```suggestion
                   throw new IllegalArgumentException(
                           "Unsupported keySharedPolicy: " + 
endpointConfiguration.getKeySharedPolicy()
                                                      + ". Only AUTO_SPLIT is 
supported. STICKY requires hash ranges which Camel does not configure.");
   ```



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