[feature] Message payload processor PIP-96 #1011
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Team,
This PR introduces message payload processor feature to Golang client. (PIP-96)
(In Java, the methods for reading messages are implemented as part of MessagePayloadContext https://github.com/apache/pulsar/blob/master/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/MessagePayloadContext.java#L65-#L79
In this PR, I used MessagePayloadContext just to carry the information and separated the above methods into a reader.)
to java implementation
Fixes #962
Motivation
As per PIP-96 proposal, it adds capabilities to process messages by the client using pluggable message processor. Same functionalities are implemented for Golang client.
Modifications
In Java Client implementation, checksum is only validated if the first bytes matches with magic number. However, the current Golang client always try to verify the checksum and return errors if checksum is not present. Due to this reasons, If we KoP and Kafka entry.format, We'll get errors when parsing MessageMeta. To avoid that, Checksum validation was separated from reading messages (We can log precise errors) and implemented similar logic we have in Java Client.
A few unexposed struct and APIs were exposed to the client. Changed the visibility as the client needs to use them when processing messages.
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesmessage
visibility was limited. It has changedOld
New
Documentation
This PR adds new feature. I have added Godoc comments in code. If additional docs/separate PR required, I could contribute.