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

[Issue 453] Add NewMessageID() method. #893

Merged
merged 2 commits into from
Dec 2, 2022

Conversation

crossoverJie
Copy link
Member

@crossoverJie crossoverJie commented Nov 29, 2022

Fixes #453

Motivation

Sometimes we need to deal with some messages manually.

pb "github.com/apache/pulsar-client-go/pulsar/internal/pulsar_proto"

	msgID := &pb.MessageIdData{
		LedgerId:             proto.Uint64(699),
		EntryId:              proto.Uint64(11),
		Partition:            proto.Int32(0),
		BatchIndex:           proto.Int32(0),
	}
	bytes, _ := proto.Marshal(msgID)
	id, _ := pulsar.DeserializeMessageID(bytes)
	err = consumer.AckID(id)

Here is the nonsensical serialization and deserialization code, also pb is an internal package and cannot be accessed externally.

Modifications

Add the NewMessageID() method.

Verifying this change

  • Make sure that the change passes the CI checks.

@nodece nodece merged commit 48c39ee into apache:master Dec 2, 2022
@RobertIndie RobertIndie added this to the v0.10.0 milestone Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make MessageID In my Project
3 participants