Class UnboundedSourceWrapper<OutputT,CheckpointMarkT extends org.apache.beam.sdk.io.UnboundedSource.CheckpointMark>
- java.lang.Object
-
- org.apache.flink.api.common.functions.AbstractRichFunction
-
- org.apache.flink.streaming.api.functions.source.RichParallelSourceFunction<org.apache.beam.sdk.values.WindowedValue<org.apache.beam.sdk.values.ValueWithRecordId<OutputT>>>
-
- org.apache.beam.runners.flink.translation.wrappers.streaming.io.UnboundedSourceWrapper<OutputT,CheckpointMarkT>
-
- All Implemented Interfaces:
java.io.Serializable,BeamStoppableFunction,org.apache.flink.api.common.functions.Function,org.apache.flink.api.common.functions.RichFunction,org.apache.flink.api.common.operators.ProcessingTimeService.ProcessingTimeCallback,org.apache.flink.api.common.state.CheckpointListener,org.apache.flink.streaming.api.checkpoint.CheckpointedFunction,org.apache.flink.streaming.api.functions.source.ParallelSourceFunction<org.apache.beam.sdk.values.WindowedValue<org.apache.beam.sdk.values.ValueWithRecordId<OutputT>>>,org.apache.flink.streaming.api.functions.source.SourceFunction<org.apache.beam.sdk.values.WindowedValue<org.apache.beam.sdk.values.ValueWithRecordId<OutputT>>>
public class UnboundedSourceWrapper<OutputT,CheckpointMarkT extends org.apache.beam.sdk.io.UnboundedSource.CheckpointMark> extends org.apache.flink.streaming.api.functions.source.RichParallelSourceFunction<org.apache.beam.sdk.values.WindowedValue<org.apache.beam.sdk.values.ValueWithRecordId<OutputT>>> implements BeamStoppableFunction, org.apache.flink.api.common.state.CheckpointListener, org.apache.flink.streaming.api.checkpoint.CheckpointedFunction, org.apache.flink.api.common.operators.ProcessingTimeService.ProcessingTimeCallback
Wrapper for executingUnboundedSourcesas a Flink Source.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description UnboundedSourceWrapper(java.lang.String stepName, org.apache.beam.sdk.options.PipelineOptions pipelineOptions, org.apache.beam.sdk.io.UnboundedSource<OutputT,CheckpointMarkT> source, int parallelism)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()voidclose()java.util.List<? extends org.apache.beam.sdk.io.UnboundedSource<OutputT,CheckpointMarkT>>getSplitSources()Visible so that we can check this in tests.voidinitializeState(org.apache.flink.runtime.state.FunctionInitializationContext context)voidnotifyCheckpointComplete(long checkpointId)voidonProcessingTime(long timestamp)voidopen(org.apache.flink.configuration.Configuration parameters)Initialize and restore state before starting execution of the source.voidrun(org.apache.flink.streaming.api.functions.source.SourceFunction.SourceContext<org.apache.beam.sdk.values.WindowedValue<org.apache.beam.sdk.values.ValueWithRecordId<OutputT>>> ctx)voidsetSourceContext(org.apache.flink.streaming.api.functions.source.SourceFunction.SourceContext<org.apache.beam.sdk.values.WindowedValue<org.apache.beam.sdk.values.ValueWithRecordId<OutputT>>> ctx)Visible so that we can set this in tests.voidsnapshotState(org.apache.flink.runtime.state.FunctionSnapshotContext functionSnapshotContext)voidstop()Unused method for backward compatibility.-
Methods inherited from class org.apache.flink.api.common.functions.AbstractRichFunction
getIterationRuntimeContext, getRuntimeContext, setRuntimeContext
-
-
-
-
Constructor Detail
-
UnboundedSourceWrapper
public UnboundedSourceWrapper(java.lang.String stepName, org.apache.beam.sdk.options.PipelineOptions pipelineOptions, org.apache.beam.sdk.io.UnboundedSource<OutputT,CheckpointMarkT> source, int parallelism) throws java.lang.Exception- Throws:
java.lang.Exception
-
-
Method Detail
-
open
public void open(org.apache.flink.configuration.Configuration parameters) throws java.lang.ExceptionInitialize and restore state before starting execution of the source.- Specified by:
openin interfaceorg.apache.flink.api.common.functions.RichFunction- Overrides:
openin classorg.apache.flink.api.common.functions.AbstractRichFunction- Throws:
java.lang.Exception
-
run
public void run(org.apache.flink.streaming.api.functions.source.SourceFunction.SourceContext<org.apache.beam.sdk.values.WindowedValue<org.apache.beam.sdk.values.ValueWithRecordId<OutputT>>> ctx) throws java.lang.Exception
- Specified by:
runin interfaceorg.apache.flink.streaming.api.functions.source.SourceFunction<OutputT>- Throws:
java.lang.Exception
-
close
public void close() throws java.lang.Exception- Specified by:
closein interfaceorg.apache.flink.api.common.functions.RichFunction- Overrides:
closein classorg.apache.flink.api.common.functions.AbstractRichFunction- Throws:
java.lang.Exception
-
cancel
public void cancel()
- Specified by:
cancelin interfaceorg.apache.flink.streaming.api.functions.source.SourceFunction<OutputT>
-
stop
public void stop()
Description copied from interface:BeamStoppableFunctionUnused method for backward compatibility.- Specified by:
stopin interfaceBeamStoppableFunction
-
snapshotState
public void snapshotState(org.apache.flink.runtime.state.FunctionSnapshotContext functionSnapshotContext) throws java.lang.Exception- Specified by:
snapshotStatein interfaceorg.apache.flink.streaming.api.checkpoint.CheckpointedFunction- Throws:
java.lang.Exception
-
initializeState
public void initializeState(org.apache.flink.runtime.state.FunctionInitializationContext context) throws java.lang.Exception- Specified by:
initializeStatein interfaceorg.apache.flink.streaming.api.checkpoint.CheckpointedFunction- Throws:
java.lang.Exception
-
onProcessingTime
public void onProcessingTime(long timestamp)
- Specified by:
onProcessingTimein interfaceorg.apache.flink.api.common.operators.ProcessingTimeService.ProcessingTimeCallback
-
getSplitSources
public java.util.List<? extends org.apache.beam.sdk.io.UnboundedSource<OutputT,CheckpointMarkT>> getSplitSources()
Visible so that we can check this in tests. Must not be used for anything else.
-
setSourceContext
public void setSourceContext(org.apache.flink.streaming.api.functions.source.SourceFunction.SourceContext<org.apache.beam.sdk.values.WindowedValue<org.apache.beam.sdk.values.ValueWithRecordId<OutputT>>> ctx)
Visible so that we can set this in tests. This is only set in the run method which is inconvenient for the tests where the context is assumed to be set when run is called. Must not be used for anything else.
-
notifyCheckpointComplete
public void notifyCheckpointComplete(long checkpointId) throws java.lang.Exception- Specified by:
notifyCheckpointCompletein interfaceorg.apache.flink.api.common.state.CheckpointListener- Throws:
java.lang.Exception
-
-