merlimat commented on a change in pull request #3267: Support set publish time
on broker side
URL: https://github.com/apache/pulsar/pull/3267#discussion_r244539440
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Producer.java
##########
@@ -148,12 +149,17 @@ public void publishMessage(long producerId, long
sequenceId, ByteBuf headersAndP
return;
}
- if (topic.isEncryptionRequired()) {
+ headersAndPayload.markReaderIndex();
+ MessageMetadata msgMetadata =
Commands.parseMessageMetadata(headersAndPayload);
+ headersAndPayload.resetReaderIndex();
+ if (msgMetadata.getPublishTime() == Constants.PUBLISH_TIME_UNSET_MS) {
Review comment:
Instead of constants, we should just use the `hasPublishTime()` method that
will report if the field was set in the serizalized protobuf binary.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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