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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to