Search in sources :

Example 1 with HBaseWindowsStoreFactory

use of org.apache.storm.hbase.trident.windowing.HBaseWindowsStoreFactory in project storm by apache.

the class TridentHBaseWindowingStoreTopology method main.

public static void main(String[] args) throws Exception {
    Config conf = new Config();
    conf.setMaxSpoutPending(20);
    conf.put(Config.TOPOLOGY_TRIDENT_WINDOWING_INMEMORY_CACHE_LIMIT, 100);
    // window-state table should already be created with cf:tuples column
    HBaseWindowsStoreFactory windowStoreFactory = new HBaseWindowsStoreFactory(new HashMap<String, Object>(), "window-state", "cf".getBytes("UTF-8"), "tuples".getBytes("UTF-8"));
    if (args.length == 0) {
        try (LocalCluster cluster = new LocalCluster();
            LocalTopology topo = cluster.submitTopology("wordCounterWithWindowing", conf, buildTopology(windowStoreFactory))) {
            Utils.sleep(120 * 1000);
        }
        System.exit(0);
    } else {
        conf.setNumWorkers(3);
        StormSubmitter.submitTopologyWithProgressBar(args[0], conf, buildTopology(windowStoreFactory));
    }
}
Also used : LocalCluster(org.apache.storm.LocalCluster) HBaseWindowsStoreFactory(org.apache.storm.hbase.trident.windowing.HBaseWindowsStoreFactory) Config(org.apache.storm.Config) LocalTopology(org.apache.storm.LocalCluster.LocalTopology)

Aggregations

Config (org.apache.storm.Config)1 LocalCluster (org.apache.storm.LocalCluster)1 LocalTopology (org.apache.storm.LocalCluster.LocalTopology)1 HBaseWindowsStoreFactory (org.apache.storm.hbase.trident.windowing.HBaseWindowsStoreFactory)1