sijie commented on a change in pull request #4079: PIP-34 Key_Shared
subscription core implementation.
URL: https://github.com/apache/pulsar/pull/4079#discussion_r278543317
##########
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:
frankly speaking, I am not sure it is a good idea to add "consume" or
"dispatch" to the "ordering-key".
in a data system, "partition-key" and "ordering-key" is actually a clean
concept. "partition-key" is used for partitioning and "ordering-key" is used
for ordering. ideally a partition-key doesn't have any ordering implication.
but because pulsar is implementing a partition based on an ordered log, the
"ordering" on a "partition-key" is implicitly indicated.
If an application needs end-to-end ordering, it can omit "ordering-key" or
choose a sub-key of "partition-key" or another related key. since end-to-end
ordering requires producers and consumers have agreements on keys.
If an application doesn't require end-to-end ordering or only needs partial
ordering (e.g. in a map-reduce-ish pipeline, an intermediate topic is used for
computing partially aggregated state), it can just use a key for partitioning
and the other key for ordering.
decoupling the partition-key and ordering-key allows adopting to more use
case in future.
However as I said in previous comment, I don't have any strong opinions
about the naming. I would let the original authors and you decide which name to
pick.
----------------------------------------------------------------
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