Package storm.trident

Examples of storm.trident.TridentTopology.newStream()


        // Note the need for two parallelismHints, as parallelismHints apply downwards up until a partitioning operation

        // There are several other partitioning operations.
        // Here is an example that uses the "global" partitining, which sends all tuples to the same partition
        // This means however, that the processing can't be distributed -- something you want to avoid
        topology
                .newStream("aggregation", spout)
                .global()
                .each(new Fields("actor"), new Print())
                .parallelismHint(3)
        ;
View Full Code Here


        TridentState nameToAge =
                topology.newStaticState(stateFactory);

        // Let's setup another state that keeps track of actor's appearance counts per location
        TridentState countState =
                topology
                        .newStream("spout", spout)
                        .groupBy(new Fields("actor","location"))
                        .persistentAggregate(new MemoryMapState.Factory(), new Count(), new Fields("count"));

        // Now, let's calculate the average age of actors seen
View Full Code Here

        System.out.println(""+kafkaConf);
   
    TridentTopology tridentTopology = new TridentTopology();
   
 
    tridentTopology.newStream(IMPRESSION_SPOUT, new OpaqueTridentKafkaSpout(kafkaConf))
            .each(new Fields("str"), new ImpressionKeyValueSplitFuncion(), new Fields("key", "raw"))
            .parallelismHint(3)
            .partitionPersist(new HBaseFactory(),
            new Fields("key", "raw"), new TridentHBaseUpdater());
           
View Full Code Here

    public static void main(String[] args) throws Exception {
        TridentTopology topology = new TridentTopology();
        List<String> hosts = Arrays.asList("localhost:9092");
        KafkaConfig kafkaConf = new KafkaConfig(KafkaConfig.StaticHosts.fromHostString(hosts, 3), "test");
        kafkaConf.scheme = new StringScheme();
        topology.newStream("mykafka", new TransactionalTridentKafkaSpout(kafkaConf))
//                .aggregate(new Count(), new Fields("count"))
                .each(new Fields("str"), new Debug());
       
        LocalCluster cluster = new LocalCluster();
       
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.