Search in sources :

Example 1 with TwitterSampleSpout

use of org.apache.storm.starter.spout.TwitterSampleSpout in project flink by apache.

the class PrintSampleStream method main.

public static void main(String[] args) throws Exception {
    if (args.length < 4) {
        System.err.println("Usage: PrintSampleStream <consumer-key> <consumer-secret> <access-token> <access-token-secret>");
        return;
    }
    String consumerKey = args[0];
    String consumerSecret = args[1];
    String accessToken = args[2];
    String accessTokenSecret = args[3];
    // keywords start with the 5th parameter
    String[] keyWords = Arrays.copyOfRange(args, 4, args.length);
    TopologyBuilder builder = new TopologyBuilder();
    builder.setSpout("twitter", new TwitterSampleSpout(consumerKey, consumerSecret, accessToken, accessTokenSecret, keyWords));
    builder.setBolt("print", new PrinterBolt()).shuffleGrouping("twitter");
    Config conf = new Config();
    final FlinkLocalCluster cluster = FlinkLocalCluster.getLocalCluster();
    cluster.submitTopology("Print", conf, FlinkTopology.createTopology(builder));
    Utils.sleep(10 * 1000);
    cluster.shutdown();
}
Also used : TopologyBuilder(org.apache.storm.topology.TopologyBuilder) TwitterSampleSpout(org.apache.storm.starter.spout.TwitterSampleSpout) Config(org.apache.storm.Config) FlinkLocalCluster(org.apache.flink.storm.api.FlinkLocalCluster) PrinterBolt(org.apache.storm.starter.bolt.PrinterBolt)

Aggregations

FlinkLocalCluster (org.apache.flink.storm.api.FlinkLocalCluster)1 Config (org.apache.storm.Config)1 PrinterBolt (org.apache.storm.starter.bolt.PrinterBolt)1 TwitterSampleSpout (org.apache.storm.starter.spout.TwitterSampleSpout)1 TopologyBuilder (org.apache.storm.topology.TopologyBuilder)1