Package storm.trident

Examples of storm.trident.TridentState


                new Values("how many apples can you eat"),
                new Values("to be or not to be the person"));
        spout.setCycle(false);
       
        TridentTopology topology = new TridentTopology();
        TridentState wordCounts =
              topology.newStream("spout1", spout)
                .parallelismHint(16)
                .each(new Fields("sentence"), new Split(), new Fields("word"))
                .groupBy(new Fields("word"))
                .persistentAggregate(new MemoryMapState.Factory(),
View Full Code Here


   
    public static StormTopology buildTopology(LocalDRPC drpc) {
        _spout = new FeederSpout(new Fields("sentence"));
       
        TridentTopology topology = new TridentTopology();
        TridentState wordCounts =
              topology.newStream("spout1", _spout)
                .parallelismHint(16)
                .each(new Fields("sentence"), new Split(), new Fields("word"))
                .groupBy(new Fields("word"))
                .persistentAggregate(new MemoryMapState.Factory(),
View Full Code Here

       
    }
   
    public static StormTopology buildTopology(LocalDRPC drpc) {
        TridentTopology topology = new TridentTopology();
        TridentState urlToTweeters =
                topology.newStaticState(
                    new StaticSingleKeyMapState.Factory(TWEETERS_DB));
        TridentState tweetersToFollowers =
                topology.newStaticState(
                    new StaticSingleKeyMapState.Factory(FOLLOWERS_DB));
       
       
        topology.newDRPCStream("reach", drpc)
View Full Code Here

                .withRotationPolicy(rotationPolicy)
                .withFsUrl(hdfsUrl);

        StateFactory factory = new HdfsStateFactory().withOptions(options);

        TridentState state = stream
                .partitionPersist(factory, hdfsFields, new HdfsUpdater(), new Fields());

        return topology.build();
    }
View Full Code Here

                .withFsUrl(hdfsUrl)
                .addRotationAction(new MoveFileAction().toDestination("/dest2/"));

        StateFactory factory = new HdfsStateFactory().withOptions(seqOpts);

        TridentState state = stream
                .partitionPersist(factory, hdfsFields, new HdfsUpdater(), new Fields());

        return topology.build();
    }
View Full Code Here

            cassandraStateFactory = CassandraMapState.nonTransactional(options);
            break;
        }
       

        TridentState wordCounts = topology.newStream("spout1", spout)
                .each(new Fields("sentence"), new Split(), new Fields("word")).groupBy(new Fields("word"))
                .persistentAggregate(cassandraStateFactory, new Count(), new Fields("count")).parallelismHint(1);

        LocalDRPC client = new LocalDRPC();
        topology.newDRPCStream("words", client).each(new Fields("args"), new Split(), new Fields("word"))
View Full Code Here

        new Values("the man went to the store and bought some candy"), new Values("four score and seven years ago"),
        new Values("how many apples can you eat"), new Values("to be or not to be the person"));
    spout.setCycle(true);

    TridentTopology topology = new TridentTopology();
    TridentState wordCounts = topology.newStream("spout1", spout).parallelismHint(16).each(new Fields("sentence"),
        new Split(), new Fields("word")).groupBy(new Fields("word")).persistentAggregate(new MemoryMapState.Factory(),
        new Count(), new Fields("count")).parallelismHint(16);

    topology.newDRPCStream("words", drpc).each(new Fields("args"), new Split(), new Fields("word")).groupBy(new Fields(
        "word")).stateQuery(wordCounts, new Fields("word"), new MapGet(), new Fields("count")).each(new Fields("count"),
View Full Code Here

  }

  public static StormTopology buildTopology(LocalDRPC drpc) {
    TridentTopology topology = new TridentTopology();
    TridentState urlToTweeters = topology.newStaticState(new StaticSingleKeyMapState.Factory(TWEETERS_DB));
    TridentState tweetersToFollowers = topology.newStaticState(new StaticSingleKeyMapState.Factory(FOLLOWERS_DB));


    topology.newDRPCStream("reach", drpc).stateQuery(urlToTweeters, new Fields("args"), new MapGet(), new Fields(
        "tweeters")).each(new Fields("tweeters"), new ExpandList(), new Fields("tweeter")).shuffle().stateQuery(
        tweetersToFollowers, new Fields("tweeter"), new MapGet(), new Fields("followers")).each(new Fields("followers"),
View Full Code Here

        TridentTopology topology = new TridentTopology();
        Stream stream = topology.newStream("spout1", spout);

        stream.partitionPersist(factory, fields,  new HBaseUpdater(), new Fields());

        TridentState state = topology.newStaticState(factory);
        stream = stream.stateQuery(state, new Fields("word"), new HBaseQuery(), new Fields("columnName","columnValue"));
        stream.each(new Fields("word","columnValue"), new PrintFunction(), new Fields());
        return topology.build();
    }
View Full Code Here

    // In this state we will save the real-time counts per date for each hashtag
    StateFactory mapState = new MemoryMapState.Factory();

    // Real-time part of the system: a Trident topology that groups by hashtag and stores per-date counts
    TridentState hashTagCounts = topology
        .newStream("spout1", spout)
        // note how we carry the date around
        .each(new Fields("tweet", "date"), new Split(), new Fields("word"))
        .each(new Fields("word", "date"), new HashTagFilter(), new Fields("hashtag"))
        .groupBy(new Fields("hashtag"))
        .persistentAggregate(mapState, new Fields("hashtag", "date"), new CountByDate(),
            new Fields("datecount"));

    // Batch part of the system:
    // We instantiate a Splout connector that doesn't fail fast so we can work without the batch layer.
    // This TridentState can be used to query Splout.
    TridentState sploutState = topology.newStaticState(new SploutState.Factory(false,
        "http://localhost:4412"));

    // DRPC service:
    // Accepts a "hashtag" argument and queries first the real-time view and then the batch-view. Finally,
    // it uses a custom Function "LambdaMerge" for merging the results and projects the results back to the user.
View Full Code Here

TOP

Related Classes of storm.trident.TridentState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.