本文整理匯總了Java中org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.createLocalEnvironmentWithWebUI方法的典型用法代碼示例。如果您正苦於以下問題:Java StreamExecutionEnvironment.createLocalEnvironmentWithWebUI方法的具體用法?Java StreamExecutionEnvironment.createLocalEnvironmentWithWebUI怎麽用?Java StreamExecutionEnvironment.createLocalEnvironmentWithWebUI使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
的用法示例。
在下文中一共展示了StreamExecutionEnvironment.createLocalEnvironmentWithWebUI方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
ParameterTool pt = ParameterTool.fromArgs(args);
String savepointsPath = pt.getRequired("savepoint-path");
Configuration config = new Configuration();
config.setString(CheckpointingOptions.SAVEPOINT_DIRECTORY, savepointsPath);
StreamExecutionEnvironment env = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(config);
env.enableCheckpointing(500, CheckpointingMode.EXACTLY_ONCE);
env.setRestartStrategy(RestartStrategies.noRestart());
env.setStateBackend(new MemoryStateBackend());
/**
* Source -> keyBy -> C(Window -> StatefulMap1 -> StatefulMap2)
*/
SingleOutputStreamOperator<Tuple2<Integer, Integer>> source = createIntegerTupleSource(env, ExecutionMode.GENERATE);
SingleOutputStreamOperator<Integer> window = createWindowFunction(ExecutionMode.GENERATE, source);
SingleOutputStreamOperator<Integer> first = createFirstStatefulMap(ExecutionMode.GENERATE, window);
SingleOutputStreamOperator<Integer> second = createSecondStatefulMap(ExecutionMode.GENERATE, first);
env.execute("job");
}
示例2: main
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
ParameterTool pt = ParameterTool.fromArgs(args);
String savepointsPath = pt.getRequired("savepoint-path");
Configuration config = new Configuration();
config.setString(CheckpointingOptions.SAVEPOINT_DIRECTORY, savepointsPath);
StreamExecutionEnvironment env = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(config);
env.enableCheckpointing(500, CheckpointingMode.EXACTLY_ONCE);
env.setRestartStrategy(RestartStrategies.noRestart());
env.setStateBackend(new MemoryStateBackend());
/**
* Source -> StatefulMap1 -> CHAIN(StatefulMap2 -> Map -> StatefulMap3)
*/
DataStream<Integer> source = createSource(env, ExecutionMode.GENERATE);
SingleOutputStreamOperator<Integer> first = createFirstStatefulMap(ExecutionMode.GENERATE, source);
first.startNewChain();
SingleOutputStreamOperator<Integer> second = createSecondStatefulMap(ExecutionMode.GENERATE, first);
second.startNewChain();
SingleOutputStreamOperator<Integer> stateless = createStatelessMap(second);
SingleOutputStreamOperator<Integer> third = createThirdStatefulMap(ExecutionMode.GENERATE, stateless);
env.execute("job");
}