kayleg / cloud-pubsub

Google Cloud PubSub client in rust
MIT License
31 stars 21 forks source link

Opening up public access to the EncodedMessage struct for binary data. #26

Closed zdannar closed 1 year ago

zdannar commented 2 years ago

Hello,

I ran into an issue where we are sending protobuf on pubsub. Pulling from a subscription with a protobuf isn't an issue. When I went to publish back to the topic, the data was being serialized and was erroring on the consumer. This is a quick fix to address the issue. As the maintainer of the lib, I am hoping you have some guidance on how you would like to deal with this type of data going forward. To address the issue, I simply made my own EncodedMessage and base64 encoded my payload. I am happy to make changes based on your recommendations.

Thank you for the crate wonderful package.

kayleg commented 1 year ago

Added support for instantiating a message without the need to serialize first: EncodedMessage::new_binary that will handle the base64::encode