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

Adding Server-Generated Message ID To Received Message Attributes #31

Merged

Conversation

arthurspa
Copy link

@arthurspa arthurspa commented Apr 9, 2024

This merge request resolves the issue I raised in #430 regarding missing server-generated message IDs in Watermill's Google Cloud Pub/Sub implementation. The change made is:

Server-Side Message ID Inclusion:
Modified the googlecloud package's default unmarshaller method to include Google's server-generated message IDs in message attributes, enabling users to access them.
A custom metadata key was created to avoid clash with existing implementations.

Test Coverage:
Added tests to ensure message IDs are present in received messages,

Expected Impact:
Improved compatibility with Google Cloud Pub/Sub.

Additional Notes:

Feedback is welcome for further refinement.

pkg/googlecloud/marshaler.go Outdated Show resolved Hide resolved
@arthurspa
Copy link
Author

arthurspa commented Apr 14, 2024

Hi @m110 , as we discussed in Discord, I've pushed a commit that sets the generated message ID to the message attributes after the message is published.

I wonder if should I call mutex.Lock() before setting the message attribute inside the Publish method though, to make it thread safe....

@m110
Copy link
Member

m110 commented Apr 15, 2024

Thank you @arthurspa!

I think the lock is not needed, as the mutex locks the publisher's internals, not the message being handled.

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.

2 participants