You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Alexander Malyga (Jira)" <ji...@apache.org> on 2020/05/27 16:12:00 UTC

[jira] [Created] (BEAM-10113) PubSubIO readMessagesWithMessageId() breaks the payload encoding when using DataflowRunner

Alexander Malyga created BEAM-10113:
---------------------------------------

             Summary: PubSubIO readMessagesWithMessageId() breaks the payload encoding when using DataflowRunner
                 Key: BEAM-10113
                 URL: https://issues.apache.org/jira/browse/BEAM-10113
             Project: Beam
          Issue Type: Bug
          Components: io-java-gcp
    Affects Versions: 2.20.0
         Environment: Running locally on MacOS Catalina 10.15.4 and as a Dataflow job in GCP.
            Reporter: Alexander Malyga
             Fix For: Not applicable


My pipeline reads PubSub messages and parses their payload to objects using Gson. I use PubsubIO.readMessagesWithMessageId() to get the PubSub message and the message ID.

I tested the pipeline thoroughly by running it with the DirectRunner in my local machine and everything works fine, but when running it as a Dataflow job in GCP using the DataflowRunner, Gson can't parse the messages properly because the first character of the payload (opening bracket "{") is missing, this only happens when using the DataflowRunner. 

I noticed that the problem no longer happens when using PubsubIO.readStrings() instead of PubsubIO.readMessagesWithMessageId() and getting the payload directly (previously I had to decode the payload using new String(element.getPayload(), StandardCharsets.UTF_8); )

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)