-
Notifications
You must be signed in to change notification settings - Fork 346
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 messageID from string and from parts #526
base: master
Are you sure you want to change the base?
Conversation
If we want to deal with string message ids, we need methods for being able to create them from either a string or a using the individual parts of the message id. This exposes some constructors for this. Tests are needed for the string message parsing, but it is taking from pulsarctl where it is well used
} | ||
return id.equal(rmsgid) | ||
} | ||
|
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.
The MessageID
is an interface, Are we here trying to compare whether two interfaces are equal?
@@ -120,19 +124,65 @@ type Message interface { | |||
type MessageID interface { | |||
// Serialize the message id into a sequence of bytes that can be stored somewhere else | |||
Serialize() []byte | |||
// String the message id represented as a string | |||
String() string |
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.
This is not needed the struct just needs to implement the Stringer interface
https://golang.org/pkg/fmt/#Stringer
// String the message id represented as a string | ||
String() string | ||
// Equals indicates to message IDs are equal | ||
Equals(other MessageID) bool |
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 don't think we should add this either. We should avoid changing the interfaces since it's a breaking change and this can be accomplished with out doing that. We can add a util method like messageIDsEqual or MessageIDsEqual
.
ping @addisonj any update for this? |
If we want to deal with string message ids, we need methods for being
able to create them from either a string or a using the individual parts
of the message id.
This exposes some constructors for this as well as an equals method to make testing more straight forward (but I am not sure if we want to expose equals...)
This is primarily to match the java implementation, but if we don't want to add the string version, we should at least expose the method to make up a message id from the individual parts.
This commit adds tests for the needed new methods