-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Issue 4803][client] return null if the message value/data is not set by producer #6379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Issue 4803][client] return null if the message value/data is not set by producer #6379
Conversation
|
Thanks @congbobo184 for his PR #4848 to provide context and unit test reference. |
|
/pulsarbot run-failure-checks |
… the PulsarApi.proto, add E2E test
37710c8 to
543b55f
Compare
…MessageBuilder<T> value(T value)` of the Class `TypedMessageBuilderImpl`.
|
@nlu90 Hi, I'm working on this feature based on your PR. Thanks. Add the flag Support users to peek the null value message by admin API. Users could send a @nlu90 @sijie @jiazhai @codelipenghui Please have a review, thanks. |
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
2 similar comments
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
… by producer (apache#6379) Fixes apache#4803 ### Motivation Allow the typed consumer receive messages with `null` value if the producer sends message without payload. ### Modifications - add a flag in `MessageMetadata` to indicate if the payload is set when the message is created - check and return `null` if the flag is not set when reading data from a message
… by producer (apache#6379) Fixes apache#4803 ### Motivation Allow the typed consumer receive messages with `null` value if the producer sends message without payload. ### Modifications - add a flag in `MessageMetadata` to indicate if the payload is set when the message is created - check and return `null` if the flag is not set when reading data from a message
) ### Motivation [#6379](#6379) introduced the feature to handle null value messages, but it only checks the null value in `ConsumerImpl` when `INCOMING_MESSAGES_SIZE_UPDATER` is updated. Therefore, if a partitioned topic with at least 2 partitions was consumed with a null value message, the NPE would be thrown. ### Modifications - Check the null value message in `MultiTopicsConsumerImpl` as well as `ConsumerImpl`. To reduce repeated code, two protected methods are added to `ConsumerBase` and `INCOMING_MESSAGES_SIZE_UPDATER` becomes private now, the derived consumer classes just use these two methods to update or reset `INCOMING_MESSAGES_SIZE_UPDATER`. - Add tests for partitioned topics in `NullValueTest`. Since the existed tests rely on the message send order, here we only send messages to a single partition only.
) [#6379](#6379) introduced the feature to handle null value messages, but it only checks the null value in `ConsumerImpl` when `INCOMING_MESSAGES_SIZE_UPDATER` is updated. Therefore, if a partitioned topic with at least 2 partitions was consumed with a null value message, the NPE would be thrown. - Check the null value message in `MultiTopicsConsumerImpl` as well as `ConsumerImpl`. To reduce repeated code, two protected methods are added to `ConsumerBase` and `INCOMING_MESSAGES_SIZE_UPDATER` becomes private now, the derived consumer classes just use these two methods to update or reset `INCOMING_MESSAGES_SIZE_UPDATER`. - Add tests for partitioned topics in `NullValueTest`. Since the existed tests rely on the message send order, here we only send messages to a single partition only. (cherry picked from commit dd3b9d8)
) ### Motivation [#6379](#6379) introduced the feature to handle null value messages, but it only checks the null value in `ConsumerImpl` when `INCOMING_MESSAGES_SIZE_UPDATER` is updated. Therefore, if a partitioned topic with at least 2 partitions was consumed with a null value message, the NPE would be thrown. ### Modifications - Check the null value message in `MultiTopicsConsumerImpl` as well as `ConsumerImpl`. To reduce repeated code, two protected methods are added to `ConsumerBase` and `INCOMING_MESSAGES_SIZE_UPDATER` becomes private now, the derived consumer classes just use these two methods to update or reset `INCOMING_MESSAGES_SIZE_UPDATER`. - Add tests for partitioned topics in `NullValueTest`. Since the existed tests rely on the message send order, here we only send messages to a single partition only. (cherry picked from commit dd3b9d8)
Fixes #4803
Motivation
Allow the typed consumer receive messages with
nullvalue if the producer sends message without payload.Modifications
MessageMetadatato indicate if the payload is set when the message is creatednullif the flag is not set when reading data from a messageVerifying this change
This change added tests and can be verified as follows:
testTypedSchemaGetNullValueinMessageImplTest.javaDoes this pull request potentially affect one of the following parts:
If
yeswas chosen, please highlight the changesDocumentation