You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/08/23 02:24:59 UTC

[GitHub] [pulsar] Jason918 commented on a diff in pull request #17195: [PIP-180] ShadowTopic - Part II - Add support for messgae_id in CommandSend

Jason918 commented on code in PR #17195:
URL: https://github.com/apache/pulsar/pull/17195#discussion_r952090399


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:
##########
@@ -813,9 +815,17 @@ protected ByteBuf encryptMessage(MessageMetadata msgMetadata, ByteBuf compressed
         }
     }
 
-    protected ByteBufPair sendMessage(long producerId, long sequenceId, int numMessages, MessageMetadata msgMetadata,
-            ByteBuf compressedPayload) {
-        return Commands.newSend(producerId, sequenceId, numMessages, getChecksumType(), msgMetadata, compressedPayload);
+    protected ByteBufPair sendMessage(long producerId, long sequenceId, int numMessages,
+                                      MessageId messageId, MessageMetadata msgMetadata,
+                                      ByteBuf compressedPayload) {
+        if (messageId instanceof MessageIdImpl) {

Review Comment:
   @eolivelli 
   
   > * regular users should not be able to set the MessageId (I don't know if there is a way)
   
   For normal users, the public method `TypedMessageBuilder<T> Producer#newMessage()` should be used to construct and send messages, but they can't set MessageId in `TypedMessageBuilder`. So messageId won't be set unless users know what they are doing.
   And currently, messageId only can be send to broker with public methods in `ProducerImpl`. It's already kind of an internal usage.
   
   > * the broker must not allow a client to write to a ledger that is not part of the topic
   
   Sure, I understand your concern, but it won't happen. The messageId will only be used by ShadowTopic and they won't have any write access to these ledgers or any ledgers. For normal topic, in case they received this messageId by some accident, they will just ignore it.



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org