DoFn Additional Parameters
In addition to the element and the OutputReceiver, Beam will populate other parameters to your
DoFn’s @ProcessElement method. Any combination of these parameters can be added to your process
method in any order.
-
Timestamp: To access the timestamp of an input element, add a parameter annotated with
@Timestamp of type Instant
-
Window: To access the window an input element falls into, add a parameter of the type of the
window used for the input PCollection.
-
PaneInfo: When triggers are used, Beam provides a PaneInfo object that contains information
about the current firing. Using PaneInfo you can determine whether this is an early or a
late firing, and how many times this window has already fired for this key.
-
PipelineOptions: The PipelineOptions for the current pipeline can always be accessed in a
process method by adding it as a parameter.
Refer to the Beam Programming Guide
"Accessing additional parameters in your DoFn" section for more information.