Search in sources :

Example 1 with TaskIdBolt

use of org.apache.flink.storm.tests.operators.TaskIdBolt in project flink by apache.

the class StormFieldsGroupingITCase method testProgram.

@Override
protected void testProgram() throws Exception {
    final String[] tokens = this.resultPath.split(":");
    final String outputFile = tokens[tokens.length - 1];
    final TopologyBuilder builder = new TopologyBuilder();
    builder.setSpout(spoutId, new FiniteRandomSpout(0, 10, 2));
    builder.setBolt(boltId, new TaskIdBolt(), 2).fieldsGrouping(spoutId, FiniteRandomSpout.STREAM_PREFIX + 0, new Fields("number"));
    builder.setBolt(sinkId, new BoltFileSink(outputFile)).shuffleGrouping(boltId);
    final FlinkLocalCluster cluster = FlinkLocalCluster.getLocalCluster();
    Config conf = new Config();
    // only required to stabilize integration test
    conf.put(FlinkLocalCluster.SUBMIT_BLOCKING, true);
    cluster.submitTopology(topologyId, conf, FlinkTopology.createTopology(builder));
    cluster.shutdown();
}
Also used : BoltFileSink(org.apache.flink.storm.util.BoltFileSink) Fields(org.apache.storm.tuple.Fields) TopologyBuilder(org.apache.storm.topology.TopologyBuilder) FlinkLocalCluster(org.apache.flink.storm.api.FlinkLocalCluster) Config(org.apache.storm.Config) FiniteRandomSpout(org.apache.flink.storm.tests.operators.FiniteRandomSpout) TaskIdBolt(org.apache.flink.storm.tests.operators.TaskIdBolt)

Aggregations

FlinkLocalCluster (org.apache.flink.storm.api.FlinkLocalCluster)1 FiniteRandomSpout (org.apache.flink.storm.tests.operators.FiniteRandomSpout)1 TaskIdBolt (org.apache.flink.storm.tests.operators.TaskIdBolt)1 BoltFileSink (org.apache.flink.storm.util.BoltFileSink)1 Config (org.apache.storm.Config)1 TopologyBuilder (org.apache.storm.topology.TopologyBuilder)1 Fields (org.apache.storm.tuple.Fields)1