chamikaramj commented on a change in pull request #12806:
URL: https://github.com/apache/beam/pull/12806#discussion_r492091684



##########
File path: sdks/python/apache_beam/io/gcp/pubsub.py
##########
@@ -290,21 +290,26 @@ def __init__(self,
         topic, id_label, with_attributes, timestamp_attribute)
 
   @staticmethod
-  def to_proto_str(element):
+  def message_to_proto_str(element):
     # type: (PubsubMessage) -> bytes
     if not isinstance(element, PubsubMessage):
       raise TypeError(
           'Unexpected element. Type: %s (expected: PubsubMessage), '
           'value: %r' % (type(element), element))
     return element._to_proto_str()
 
+  @staticmethod
+  def bytes_to_proto_str(element):
+    # type: (bytes) -> bytes
+    msg = pubsub.types.pubsub_pb2.PubsubMessage()
+    msg.data = element
+    return msg.SerializeToString()
+
   def expand(self, pcoll):
     if self.with_attributes:

Review comment:
       Sent https://github.com/apache/beam/pull/12888




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to