[ 
https://issues.apache.org/jira/browse/BEAM-8932?focusedWorklogId=367961&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-367961
 ]

ASF GitHub Bot logged work on BEAM-8932:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 08/Jan/20 03:41
            Start Date: 08/Jan/20 03:41
    Worklog Time Spent: 10m 
      Work Description: kennknowles commented on pull request #10474: 
[BEAM-8932] [BEAM-9036] Revert reverted commit to use PubsubMessage as the 
canonical type in beam client
URL: https://github.com/apache/beam/pull/10474#discussion_r364052652
 
 

 ##########
 File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubJsonClient.java
 ##########
 @@ -171,7 +172,12 @@ public int publish(TopicPath topic, List<OutgoingMessage> 
outgoingMessages) thro
     List<IncomingMessage> incomingMessages = new 
ArrayList<>(response.getReceivedMessages().size());
     for (ReceivedMessage message : response.getReceivedMessages()) {
       PubsubMessage pubsubMessage = message.getMessage();
-      @Nullable Map<String, String> attributes = pubsubMessage.getAttributes();
+      Map<String, String> attributes;
+      if (pubsubMessage.getAttributes() != null) {
+        attributes = pubsubMessage.getAttributes();
+      } else {
+        attributes = new HashMap<>();
 
 Review comment:
   This would be more efficient and clear as `Collections.emptyMap()` which is 
immutable and does not involve allocation.
 
----------------------------------------------------------------
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:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 367961)
    Time Spent: 9h 10m  (was: 9h)

> Expose complete Cloud Pub/Sub messages through PubsubIO API
> -----------------------------------------------------------
>
>                 Key: BEAM-8932
>                 URL: https://issues.apache.org/jira/browse/BEAM-8932
>             Project: Beam
>          Issue Type: Bug
>          Components: beam-model
>            Reporter: Daniel Collins
>            Assignee: Daniel Collins
>            Priority: Major
>          Time Spent: 9h 10m
>  Remaining Estimate: 0h
>
> The PubsubIO API only exposes a subset of the fields in the underlying 
> PubsubMessage protocol buffer. To accomodate future feature changes as well 
> as for greater compatability with code using the Cloud Pub/Sub apis, a method 
> to read and write these protocol messages should be exposed.



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

Reply via email to