Package storm.trident.testing

Examples of storm.trident.testing.Split


            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"))
                .groupBy(new Fields("word"))
                .stateQuery(wordCounts, new Fields("word"), new MapGet(), new Fields("count"))
                .each(new Fields("count"), new FilterNull())
                .aggregate(new Fields("count"), new Sum(), new Fields("sum"));
View Full Code Here


    // 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.
    topology
        .newDRPCStream("hashtags", drpc)
        .each(new Fields("args"), new Split(), new Fields("hashtag"))
        .groupBy(new Fields("hashtag"))
        .stateQuery(hashTagCounts, new Fields("hashtag"), new MapGet(), new Fields("resultrt"))
        .stateQuery(sploutState, new Fields("hashtag", "resultrt"), new HashTagsSploutQuery(),
            new Fields("resultbatch"))
        .each(new Fields("hashtag", "resultrt", "resultbatch"), new LambdaMerge(), new Fields("result"))
View Full Code Here

TOP

Related Classes of storm.trident.testing.Split

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.