Skip to content
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

Add properties filed for batch container #683

Merged
merged 1 commit into from
Dec 10, 2021

Conversation

wolfstudy
Copy link
Member

Signed-off-by: xiaolongran xiaolongran@tencent.com

Motivation

Currently, when we disable batch in Producer, in handleSend() of serverCnx.java, the msgMetadata.hasNumMessagesInBatch() is true and msgMetadata.getNumMessagesInBatch() is 1.

At this point, if we get the Properties object we set on the producer side on the broker side, the display is empty.

Go SDK set Properties:


// disable batch
producer, err := client.CreateProducer(pulsar.ProducerOptions{
	Topic: "topic-1",
	DisableBatching: true,
})

// set properties for every message
producer.Send(ctx, &pulsar.ProducerMessage{
	Payload: []byte(fmt.Sprintf("hello-%d", i)),
	Properties: map[string]string{
		"key-1": "value-1",
	},
});

Broker get message properties from entry metadata is null:

ByteBuf metadataAndPayload = entry.getDataBuffer();

MessageMetadata msgMetadata = Commands.peekMessageMetadata(metadataAndPayload, subscription.toString(), -1);

And msgMetadata.getPropertiesCount() <= 0.

Modifications

Add properties filed in Add single message to batchContainer

Signed-off-by: xiaolongran <xiaolongran@tencent.com>
@wolfstudy wolfstudy added this to the v0.8.0 milestone Dec 10, 2021
@wolfstudy wolfstudy self-assigned this Dec 10, 2021
@wolfstudy wolfstudy merged commit d0d5d0a into apache:master Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants