google cloud dataflow - can I get "event-time" from meta-data? -
greeting developers,
know dataflow(df) can event-time i/o (like pubsub), , can assign "event-time" data. but, can attribute value data?
understanding, can input timestamp(processing-time) data, not event-time.
q1: can event-time data ?
q2: if can, how ?
thanks helping :d
to timestamp of element in dofn, can call processcontext.timestamp(). set timestamp of element according own application logic, can use context.outputwithtimestamp().
like so:
@override public void processelement(processcontext c) { // generate timestamp falls somewhere in 2 hours after event time. long randmillis = (long) (math.random() * duration.standardhours(2).getmillis()); instant randomtimestamp = c.timestamp().plus(randmillis); c.outputwithtimestamp(c.element(), new instant(randomtimestamp)); }
Comments
Post a Comment