DataflowJavaSDK icon indicating copy to clipboard operation
DataflowJavaSDK copied to clipboard

PubsubMessage readed form PubsubIO have no attributes

Open chikien276 opened this issue 7 years ago • 1 comments
trafficstars

Dataflow SDK version: 2.4.0 I haven't tested with other attribute but when we use these attribute for de-duplication and timestaming we got null PubsubMessage's attribute For example

PubsubIO.readMessages()
                        .fromSubscription("mine")
                        .withIdAttribute("id"))
                .apply("name hehe", ParDo.of(new DoFn<PubsubMessage, String>() {

                    @ProcessElement
                    public void processElement(ProcessContext c) {
                        PubsubMessage message = c.element();
                        c.output(new String(message.getPayload(), Charset.forName("UTF-8"))

                                + " id: " + message.getAttribute("id")); // id will be null here
                    }
                }))

same with .withTimestampAttribute(str)

chikien276 avatar Apr 03 '18 10:04 chikien276

Has this problem been resolved?

sx5640 avatar Nov 07 '18 21:11 sx5640