merlimat commented on a change in pull request #4079: PIP-34 Key_Shared 
subscription core implementation.
URL: https://github.com/apache/pulsar/pull/4079#discussion_r278418822
 
 

 ##########
 File path: 
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/TypedMessageBuilder.java
 ##########
 @@ -103,6 +103,15 @@
      */
     TypedMessageBuilder<T> keyBytes(byte[] key);
 
+    /**
+     * Sets the ordering key of the message for message dispatch in {@link 
SubscriptionType#Key_Shared} mode.
+     * Partition key Will be used if ordering key not specified
+     *
+     * @param orderingKey the ordering key for the message
+     * @return the message builder instance
+     */
+    TypedMessageBuilder<T> orderingKey(byte[] orderingKey);
 
 Review comment:
   > when you are using a term of "sub-key", it means you need both 
partition-key and sub-key together for deciding the ordering. in my example 
explained above, "from_user_id" and "conversation_id" might have some 
application specific relationship. but "conversation_id" is not necessarily a 
"sub-key" of "from_user_id". Instead, "conversation_id" provides an alternative 
way for grouping and ordering conversations than using "from_user_id".
   
   On a partition topic the ordering will be on 2 layers. Ordering will be 
based on the combination of both. 
   
   If you say these 2 keys are not related, then, on a partitioned topic, the 
"ordering-key" will not be able to guarantee the ordering, which sounds a bit 
weird...
   
   I'm not saying to use any of the examples which just came out of the mind. 
I'm saying that "orderingKey" can be very confusing to users because it seems 
to be implying something which is not.
   
   What the application means with the key is up to the application. What it 
means on the dispatcher is that, *within a given partition*, all messages with 
same key will go to same consumer. "Ordering-Key" as a name fails to convey any 
of the properties while clashing with the partition key that is already used to 
decide the ordering on the partitions.
   
   To throw more names:  "consumeOrderingKey", "dispatchOrderingKey" 
   
   > You are overreacting to what I said here. I just meant the name was coming 
up from the discussion thread. I also didn't say it is a final. 
   
   Am I? Perhaps it was not intended but your phrase sounded exactly like that.
   

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


With regards,
Apache Git Services

Reply via email to