Class LocalStreamEnvironment
java.lang.Object
org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
org.apache.flink.streaming.api.environment.LocalStreamEnvironment
- All Implemented Interfaces:
AutoCloseable
The LocalStreamEnvironment is a StreamExecutionEnvironment that runs the program locally,
multi-threaded, in the JVM where the environment is instantiated. It spawns an embedded Flink
cluster in the background and executes the program on that cluster.
-
Field Summary
Fields inherited from class org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
cacheFile, checkpointCfg, config, configuration, transformations -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new mini cluster stream environment that uses the default configuration.LocalStreamEnvironment(org.apache.flink.configuration.Configuration configuration) Creates a new mini cluster stream environment that configures its local executor with the given configuration. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.flink.api.common.JobExecutionResultexecute(StreamGraph streamGraph) Triggers the program execution.Methods inherited from class org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
addOperator, addSource, addSource, addSource, addSource, areExplicitEnvironmentsAllowed, clean, clearJobListeners, close, configure, configure, createInput, createInput, createLocalEnvironment, createLocalEnvironment, createLocalEnvironment, createLocalEnvironment, createLocalEnvironmentWithWebUI, createRemoteEnvironment, createRemoteEnvironment, createRemoteEnvironment, disableOperatorChaining, enableChangelogStateBackend, enableCheckpointing, enableCheckpointing, enableCheckpointing, execute, execute, executeAsync, executeAsync, executeAsync, fromCollection, fromCollection, fromCollection, fromCollection, fromData, fromData, fromData, fromData, fromData, fromElements, fromElements, fromParallelCollection, fromParallelCollection, fromSequence, fromSource, fromSource, generateSequence, generateStreamGraph, getBufferTimeout, getCachedFiles, getCheckpointConfig, getCheckpointingConsistencyMode, getCheckpointingMode, getCheckpointInterval, getConfig, getConfiguration, getDefaultLocalParallelism, getDefaultSavepointDirectory, getExecutionEnvironment, getExecutionEnvironment, getExecutionPlan, getJobListeners, getMaxParallelism, getParallelism, getStreamGraph, getStreamGraph, getTransformations, getUserClassloader, initializeContextEnvironment, invalidateClusterDataset, isChainingEnabled, isChainingOfOperatorsWithDifferentMaxParallelismEnabled, isChangelogStateBackendEnabled, isForceUnalignedCheckpoints, isUnalignedCheckpointsEnabled, listCompletedClusterDatasets, readFile, readFile, readFile, readFile, readFileStream, registerCachedFile, registerCachedFile, registerCacheTransformation, registerCollectIterator, registerJobListener, registerSlotSharingGroup, resetContextEnvironment, setBufferTimeout, setDefaultLocalParallelism, setDefaultSavepointDirectory, setDefaultSavepointDirectory, setDefaultSavepointDirectory, setMaxParallelism, setParallelism, setRuntimeMode, socketTextStream, socketTextStream, socketTextStream, socketTextStream, socketTextStream
-
Constructor Details
-
LocalStreamEnvironment
public LocalStreamEnvironment()Creates a new mini cluster stream environment that uses the default configuration. -
LocalStreamEnvironment
public LocalStreamEnvironment(@Nonnull org.apache.flink.configuration.Configuration configuration) Creates a new mini cluster stream environment that configures its local executor with the given configuration.- Parameters:
configuration- The configuration used to configure the local executor.
-
-
Method Details
-
execute
public org.apache.flink.api.common.JobExecutionResult execute(StreamGraph streamGraph) throws Exception Description copied from class:StreamExecutionEnvironmentTriggers the program execution. The environment will execute all parts of the program that have resulted in a "sink" operation. Sink operations are for example printing results or forwarding them to a message queue.- Overrides:
executein classStreamExecutionEnvironment- Parameters:
streamGraph- the stream graph representing the transformations- Returns:
- The result of the job execution, containing elapsed time and accumulators.
- Throws:
Exception- which occurs during job execution.
-