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 messageID from string and from parts #526

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

addisonj
Copy link
Contributor

@addisonj addisonj commented May 22, 2021

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

addisonj added 2 commits May 22, 2021 15:29
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
@addisonj addisonj requested a review from merlimat May 22, 2021 21:54
@addisonj addisonj changed the title Add message string Add messageID from string and from parts May 22, 2021
}
return id.equal(rmsgid)
}

Copy link
Member

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?

@wolfstudy wolfstudy added this to the 0.6.0 milestone May 24, 2021
@@ -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
Copy link
Contributor

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
Copy link
Contributor

@cckellogg cckellogg May 24, 2021

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.

@wolfstudy
Copy link
Member

ping @addisonj any update for this?

@wolfstudy wolfstudy modified the milestones: 0.6.0, 0.7.0 Jul 21, 2021
@wolfstudy wolfstudy modified the milestones: 0.7.0, v0.8.0 Nov 1, 2021
@wolfstudy wolfstudy modified the milestones: v0.8.0, 0.9.0 Feb 16, 2022
@freeznet freeznet modified the milestones: v0.9.0, v0.10.0 Jul 4, 2022
@RobertIndie RobertIndie modified the milestones: v0.10.0, v0.11.0 Mar 27, 2023
@RobertIndie RobertIndie modified the milestones: v0.11.0, v0.12.0 Jul 4, 2023
@RobertIndie RobertIndie modified the milestones: v0.12.0, v0.13.0 Jan 10, 2024
@RobertIndie RobertIndie modified the milestones: v0.13.0, v0.14.0 Jul 15, 2024
@RobertIndie RobertIndie modified the milestones: v0.14.0, v0.15.0 Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants