@Experimental public interface JvmInitializer
During pipeline execution, onStartup
and beforeProcessing
will be invoked at
the appropriate stage of execution after the JVM is launched. Currently this is only supported in
portable pipelines or when using Google Cloud Dataflow.
ServiceLoader
is used to discover implementations of JvmInitializer
,
note that you will need to register your implementation with the appropriate resources to ensure
your code is executed. You can use a tool like AutoService
to
automate this.
Modifier and Type | Method and Description |
---|---|
default void |
beforeProcessing(PipelineOptions options)
Implement beforeProcessing to run some custom initialization after basic services such as
logging, but before data processing begins.
|
default void |
onStartup()
Implement onStartup to run some custom initialization immediately after the JVM is launched for
pipeline execution.
|
default void onStartup()
In general users should prefer to implement beforeProcessing
to perform custom
initialization so that basic services such as logging can be initialized first, but onStartup
is also provided if initialization absolutely needs to be run immediately after
starting.
default void beforeProcessing(PipelineOptions options)
options
- The pipeline options passed to the worker.