Java Code Examples for org.apache.flink.streaming.api.datastream.DataStream#connect()

The following examples show how to use org.apache.flink.streaming.api.datastream.DataStream#connect() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StreamGraphGeneratorTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Test
public void testOutputTypeConfigurationWithTwoInputTransformation() throws Exception {
	StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

	DataStream<Integer> source1 = env.fromElements(1, 10);
	DataStream<Integer> source2 = env.fromElements(2, 11);

	ConnectedStreams<Integer, Integer> connectedSource = source1.connect(source2);

	OutputTypeConfigurableOperationWithTwoInputs outputTypeConfigurableOperation = new OutputTypeConfigurableOperationWithTwoInputs();

	DataStream<Integer> result = connectedSource.transform(
			"Two input and output type configurable operation",
			BasicTypeInfo.INT_TYPE_INFO,
			outputTypeConfigurableOperation);

	result.addSink(new DiscardingSink<>());

	env.getStreamGraph();

	assertEquals(BasicTypeInfo.INT_TYPE_INFO, outputTypeConfigurableOperation.getTypeInformation());
}
 
Example 2
Source File: StreamGraphGeneratorTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void testOutputTypeConfigurationWithTwoInputTransformation() throws Exception {
	StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

	DataStream<Integer> source1 = env.fromElements(1, 10);
	DataStream<Integer> source2 = env.fromElements(2, 11);

	ConnectedStreams<Integer, Integer> connectedSource = source1.connect(source2);

	OutputTypeConfigurableOperationWithTwoInputs outputTypeConfigurableOperation = new OutputTypeConfigurableOperationWithTwoInputs();

	DataStream<Integer> result = connectedSource.transform(
			"Two input and output type configurable operation",
			BasicTypeInfo.INT_TYPE_INFO,
			outputTypeConfigurableOperation);

	result.addSink(new DiscardingSink<>());

	env.getStreamGraph();

	assertEquals(BasicTypeInfo.INT_TYPE_INFO, outputTypeConfigurableOperation.getTypeInformation());
}
 
Example 3
Source File: StreamGraphGeneratorTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void testOutputTypeConfigurationWithTwoInputTransformation() throws Exception {
	StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

	DataStream<Integer> source1 = env.fromElements(1, 10);
	DataStream<Integer> source2 = env.fromElements(2, 11);

	ConnectedStreams<Integer, Integer> connectedSource = source1.connect(source2);

	OutputTypeConfigurableOperationWithTwoInputs outputTypeConfigurableOperation = new OutputTypeConfigurableOperationWithTwoInputs();

	DataStream<Integer> result = connectedSource.transform(
			"Two input and output type configurable operation",
			BasicTypeInfo.INT_TYPE_INFO,
			outputTypeConfigurableOperation);

	result.addSink(new DiscardingSink<>());

	env.getStreamGraph();

	assertEquals(BasicTypeInfo.INT_TYPE_INFO, outputTypeConfigurableOperation.getTypeInformation());
}