-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[pulsar-client-go]add producer.LastSequenceID and message SequenceID in Go client #3416
Conversation
Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
pulsar-client-go/pulsar/producer.go
Outdated
@@ -163,6 +163,14 @@ type Producer interface { | |||
// the eventual error in publishing | |||
SendAsync(context.Context, ProducerMessage, func(ProducerMessage, error)) | |||
|
|||
// Get the last sequence id that was published by this producer. | |||
// This represent either the automatically assigned or custom sequence id (set on the MessageBuilder) that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of MessageBuilder
which is in Java client lib, we should refer to ProducerMessage
here (https://github.com/apache/pulsar/blob/master/pulsar-client-go/pulsar/message.go#L24)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the ProducerMessage
doesn't currently have a way to specify the sequence id of a particular message. This should be done by using pulsar_message_set_sequence_id()
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, you are reight. I will provide this interface to achieve the corresponding function in next pull request.
Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
PTAL @merlimat thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, juts one last comment on renaming ID
-> SequenceID
pulsar-client-go/pulsar/message.go
Outdated
@@ -36,6 +36,9 @@ type ProducerMessage struct { | |||
|
|||
// Override the replication clusters for this message. | |||
ReplicationClusters []string | |||
|
|||
// Set the sequence id to assign to the current message | |||
ID int64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use SequenceID
here to avoid confusion with the "MessageId" concept which is different. eg. On a received message, Message.ID()
will give you the MessageId (assigned by brokers) rather than the sequence id (assigned by producer).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the same time, I think we should also expose a way to retrieve the sequence id on a received message as in Message.SequenceID()
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, SequenceID
sounds good. About Message.SequenceID()
method, i will provide in the next pull request.
Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
@merlimat PTAL again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
run java8 tests |
Signed-off-by: xiaolong.ran ranxiaolong716@gmail.com
Motivation
Add producer.LastSequenceID and message SequenceID in Go client.