.connect(stream).flatMap(new LeftIdentityCoRichFlatMapFunction())
.flatMap(new CoFlatMapFunction<Long, Long, Long>() {
.flatMap(new CoFlatMapFunction<Long, Long, Long>() { @Override public void flatMap1(Long value, Collector<Long> out) throws Exception {
.connect(stream).flatMap(new LeftIdentityCoRichFlatMapFunction())
.flatMap(new CoFlatMapFunction<Integer, Tuple2<Integer, Integer>, String>() {
source.connect(source).flatMap(new TestCoFlatMap<Long, Long, Integer>()).print(); fail(); } catch (Exception ignored) {} source.flatMap(new TestFlatMap<Long, Long>()).returns(new TypeHint<Long>(){}).print(); source.connect(source).map(new TestCoMap<Long, Long, Integer>()).returns(BasicTypeInfo.INT_TYPE_INFO).print(); source.connect(source).flatMap(new TestCoFlatMap<Long, Long, Integer>()) .returns(BasicTypeInfo.INT_TYPE_INFO).print(); source.connect(source).keyBy(new TestKeySelector<>(), new TestKeySelector<>(), Types.STRING);
mergedInputStream = singleInputStream .connect(inputStream2) .flatMap( new TwoFlinkStreamsMerger(streamId1, inputSchema1, streamId2, this.outputStreams.get( mergedInputStream = mergedInputStream .connect(inputStream2) .flatMap( new StormFlinkStreamMerger(streamId2, this.outputStreams.get( streamId2.get_componentId()).get(streamId2.get_streamId())))
public static void main(String[] args) throws Exception { ParameterTool params = ParameterTool.fromArgs(args); final String ridesFile = params.get("rides", pathToRideData); final String faresFile = params.get("fares", pathToFareData); final int delay = 60; // at most 60 seconds of delay final int servingSpeedFactor = 1800; // 30 minutes worth of events are served every second // set up streaming execution environment StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime); env.setParallelism(ExerciseBase.parallelism); DataStream<TaxiRide> rides = env .addSource(rideSourceOrTest(new TaxiRideSource(ridesFile, delay, servingSpeedFactor))) .filter((TaxiRide ride) -> ride.isStart) .keyBy("rideId"); DataStream<TaxiFare> fares = env .addSource(fareSourceOrTest(new TaxiFareSource(faresFile, delay, servingSpeedFactor))) .keyBy("rideId"); DataStream<Tuple2<TaxiRide, TaxiFare>> enrichedRides = rides .connect(fares) .flatMap(new EnrichmentFunction()); printOrTest(enrichedRides); env.execute("Join Rides with Fares (java RichCoFlatMap)"); }
public static void main(String[] args) throws Exception { ParameterTool params = ParameterTool.fromArgs(args); final String ridesFile = params.get("rides", pathToRideData); final String faresFile = params.get("fares", pathToFareData); final int delay = 60; // at most 60 seconds of delay final int servingSpeedFactor = 1800; // 30 minutes worth of events are served every second // set up streaming execution environment StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime); env.setParallelism(ExerciseBase.parallelism); DataStream<TaxiRide> rides = env .addSource(rideSourceOrTest(new TaxiRideSource(ridesFile, delay, servingSpeedFactor))) .filter((TaxiRide ride) -> ride.isStart) .keyBy("rideId"); DataStream<TaxiFare> fares = env .addSource(fareSourceOrTest(new TaxiFareSource(faresFile, delay, servingSpeedFactor))) .keyBy("rideId"); DataStream<Tuple2<TaxiRide, TaxiFare>> enrichedRides = rides .connect(fares) .flatMap(new EnrichmentFunction()); printOrTest(enrichedRides); env.execute("Join Rides with Fares (java RichCoFlatMap)"); }
.keyBy("key") .connect(controlStream) .flatMap(new AmplifierFunction()) .addSink(new InfluxDBSink<>("amplifiedSensors"));