apache / apache/beam

Specify the event time when consuming pubsub data.

Open
#20,686 0 comments 0 reactions 0 assignees View on GitHub
gcp improvement io java P3
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

I need to specify the event time when consuming pubsub data.
```

PCollection pubsubMessages = pipeline.apply("Read Pub/Sub Data",
PubsubIO.readMessagesWithAttributes()

.withTimestampAttribute(options.getTimeAttribute())
.fromSubscription(options.getInputSubscription()));

```

The only way to do this is to use the {color:#ff0000}withTimestampAttribute(){color} method.

But if  I use a timestamp in some other format, such as a 19-bit nanosecond, or if save the event time in the payload. The method won't work !

So I had to extend the PubsubClient class and override the PubsubClient. extractTimestamp() method.

I'am hoping to provide a way to pass in some implementation class that would allow to parse out timestamp from the current pubsub message.

 

My beam version is 2.19.0.

 

 

 

Imported from Jira [BEAM-10926](https://issues.apache.org/jira/browse/BEAM-10926). Original Jira may contain additional context.
Reported by: j.zheng.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.