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

feat(pubsublite): Message type and message routers #3077

Merged
merged 7 commits into from
Oct 28, 2020

Conversation

tmdiep
Copy link
Contributor

@tmdiep tmdiep commented Oct 23, 2020

Message is similar to pubsub.Message, with the following differences:

  • Attributes can have multiple values for the same key.
  • Pub/Sub Lite uses []byte for data, attribute values and ordering keys.

Message routers select a partition to route a published message to, based on whether it has an ordering key specified.

@tmdiep tmdiep requested a review from a team as a code owner October 23, 2020 08:38
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Oct 23, 2020
@tmdiep
Copy link
Contributor Author

tmdiep commented Oct 23, 2020

Any opinions on the use of []byte everywhere in the Message struct are welcome.

IMO, strings are much easier to work with. However, Lite uses bytestrings for everything. The Java client libraries for CPS and Lite also have different Message types, so perhaps this deviation is acceptable for Go too.

@tmdiep tmdiep added the api: pubsublite Issues related to the Pub/Sub Lite API. label Oct 23, 2020
Copy link
Member

@codyoss codyoss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I'll defer to Alex

@tmdiep
Copy link
Contributor Author

tmdiep commented Oct 26, 2020

WANT_LGTM=@hongalex, @manuelmenzella-google

Do either of you have concerns about differing from pubsub.Message? It differs in the Java client libraries too, so I think it should be fine.

I prefer strings over []byte, but had some concerns about actual bytes being written to the message in another client library and looking strange converted to a string when read from the Go client lib.

@hongalex
Copy link
Member

hongalex commented Oct 27, 2020

I agree strings are easier to work with, but yeah considering people can use pub/sub lite across languages, this should be standardized across client libraries. I say stick with []byte.

@tmdiep
Copy link
Contributor Author

tmdiep commented Oct 28, 2020

Thanks everyone, []bytes it is! Merging...

@tmdiep tmdiep merged commit 179fc55 into googleapis:master Oct 28, 2020
@tmdiep tmdiep deleted the message branch October 28, 2020 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsublite Issues related to the Pub/Sub Lite API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants