codelipenghui commented on a change in pull request #11553:
URL: https://github.com/apache/pulsar/pull/11553#discussion_r685177525



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -186,6 +186,7 @@
     private boolean preciseTopicPublishRateLimitingEnable;
     private boolean encryptionRequireOnProducer;
 
+    private boolean exposingBrokerEntryMetadataToClientEnabled;

Review comment:
       Why do we need to add ServerCnx? Is it able to get from the 
ServiceConfiguration directly?

##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
##########
@@ -1236,8 +1240,9 @@ private void interceptAndComplete(final Message<T> 
message, final CompletableFut
         completePendingReceive(receivedFuture, interceptMessage);
     }
 
-    void receiveIndividualMessagesFromBatch(MessageMetadata msgMetadata, int 
redeliveryCount, List<Long> ackSet, ByteBuf uncompressedPayload,
-            MessageIdData messageId, ClientCnx cnx) {
+    void receiveIndividualMessagesFromBatch(BrokerEntryMetadata 
brokerEntryMetadata, MessageMetadata msgMetadata,

Review comment:
       Could you please help add a test to cover the batch message case?

##########
File path: 
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/Message.java
##########
@@ -245,4 +245,22 @@
      * @since 2.8.0
      */
     void release();
+
+    /**
+     * Get broker publish time from broker entry metadata.
+     * Note that only if the feature is enabled in the broker then the value 
is available.
+     *
+     * @since 2.9.0
+     * @return broker publish time from broker entry metadata, or empty if the 
feature is not enabled in the broker.
+     */
+    Optional<Long> getBrokerPublishTime();

Review comment:
       It's better to add a method for checking if has broker publish time, 
such as` boolean hasBrokerPublishTime()`;

##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessageImpl.java
##########
@@ -663,6 +664,22 @@ public void release() {
         }
     }
 
+    @Override
+    public Optional<Long> getBrokerPublishTime() {
+        if (brokerEntryMetadata != null && 
brokerEntryMetadata.hasBrokerTimestamp()) {
+            return Optional.of(brokerEntryMetadata.getBrokerTimestamp());
+        }
+        return Optional.empty();
+    }
+
+    @Override
+    public Optional<Long> getIndex() {
+        if (brokerEntryMetadata != null && brokerEntryMetadata.hasIndex()) {

Review comment:
       For a batch message, we only have one index in the broker entry 
metadata, we will get the same index for the individual messages of a batch.

##########
File path: 
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/Message.java
##########
@@ -245,4 +245,22 @@
      * @since 2.8.0
      */
     void release();
+
+    /**
+     * Get broker publish time from broker entry metadata.
+     * Note that only if the feature is enabled in the broker then the value 
is available.
+     *
+     * @since 2.9.0
+     * @return broker publish time from broker entry metadata, or empty if the 
feature is not enabled in the broker.
+     */
+    Optional<Long> getBrokerPublishTime();
+
+    /**
+     * Get index from broker entry metadata.
+     * Note that only if the feature is enabled in the broker then the value 
is available.
+     *
+     * @since 2.9.0
+     * @return index from broker entry metadata, or empty if the feature is 
not enabled in the broker.
+     */
+    Optional<Long> getIndex();

Review comment:
       It better to add a method for checking if has index, such as `boolean 
hasIndex()`




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