org.apache.storm.Config - java examples

Here are the examples of the java api org.apache.storm.Config taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

152 Examples 7

19 View Complete Implementation : Arg.java
Copyright Apache License 2.0
Author : apache
public clreplaced Arg {

    private Config config;

    private String arg;

    public Arg(Config config, String arg) {
        this.config = config;
        this.arg = arg;
    }

    public Config getConfig() {
        return config;
    }

    public String getArg() {
        return arg;
    }
}

19 View Complete Implementation : AppMain.java
Copyright MIT License
Author : Paleozoic
public void Laugher() throws InvalidTopologyException, AuthorizationException, AlreadyAliveException, InterruptedException {
    Config config = new Config();
    remoteSubmit(stormProps, topologyBuilder, config);
// localSubmit(stormProps.getTopologyName(),topologyBuilder,config);
}

18 View Complete Implementation : FlowTopologyTest.java
Copyright Apache License 2.0
Author : telstra
@BeforeClreplaced
public static void setupOnce() throws Exception {
    AbstractStormTest.startZooKafkaAndStorm();
    embeddedNeo4jDb = new EmbeddedNeo4jDatabase(fsData.getRoot());
    LaunchEnvironment launchEnvironment = makeLaunchEnvironment();
    Properties configOverlay = new Properties();
    configOverlay.setProperty("neo4j.uri", embeddedNeo4jDb.getConnectionUri());
    // ask to create indexes/constraints if needed
    configOverlay.setProperty("neo4j.indexes.auto", "update");
    launchEnvironment.setupOverlay(configOverlay);
    Neo4jConfig neo4jConfig = launchEnvironment.getConfigurationProvider().getConfiguration(Neo4jConfig.clreplaced);
    NetworkConfig networkConfig = launchEnvironment.getConfigurationProvider().getConfiguration(NetworkConfig.clreplaced);
    persistenceManager = new Neo4jPersistenceManager(neo4jConfig, networkConfig);
    flowTopology = new FlowTopology(launchEnvironment);
    topologyConfig = flowTopology.getConfig();
    StormTopology stormTopology = flowTopology.createTopology();
    Config config = stormConfig();
    cluster.submitTopology(FlowTopologyTest.clreplaced.getSimpleName(), config, stormTopology);
    nbConsumer = new TestKafkaConsumer(topologyConfig.getKafkaNorthboundTopic(), Destination.NORTHBOUND, kafkaProperties(UUID.nameUUIDFromBytes(Destination.NORTHBOUND.toString().getBytes()).toString()));
    nbConsumer.start();
    ofsConsumer = new TestKafkaConsumer(topologyConfig.getKafkaSpeakerFlowTopic(), Destination.CONTROLLER, kafkaProperties(UUID.nameUUIDFromBytes(Destination.CONTROLLER.toString().getBytes()).toString()));
    ofsConsumer.start();
    ctrlConsumer = new TestKafkaConsumer(flowTopology.getConfig().getKafkaCtrlTopic(), Destination.CTRL_CLIENT, kafkaProperties(UUID.nameUUIDFromBytes(Destination.CTRL_CLIENT.toString().getBytes()).toString()));
    ctrlConsumer.start();
    Utils.sleep(TOPOLOGY_START_TIMEOUT);
}

18 View Complete Implementation : TopMeetupTopicsTopology.java
Copyright Apache License 2.0
Author : apsaltis
private Config getConfig() {
    Config config = new Config();
    config.setDebug(true);
    return config;
}

18 View Complete Implementation : SingleTopology.java
Copyright GNU Lesser General Public License v3.0
Author : JiuzhouSec
/**
 * Created by caodaoxi on 16-4-5.
 */
public clreplaced SingleTopology {

    private static final Logger LOG = LoggerFactory.getLogger(SingleTopology.clreplaced);

    private static Config config = new Config();

    public static void main(String[] args) throws Exception {
        Configuration.init("rtc_local.properties");
        TopologyBuilder builder = buildTopology();
        submitTopology(builder);
    }

    private static TopologyBuilder buildTopology() throws Exception {
        TopologyBuilder builder = new TopologyBuilder();
        String topicName = Configuration.getConfig().getString("rtc.mq.spout.topic");
        String groupName = Configuration.getConfig().getString("rtc.mq.spout.group");
        BrokerHosts hosts = new ZkHosts(Configuration.getConfig().getString("rtc.zk.hosts"));
        SpoutConfig spoutConfig = new SpoutConfig(hosts, topicName, "/consumers", groupName);
        spoutConfig.startOffsetTime = kafka.api.OffsetRequest.LatestTime();
        spoutConfig.zkServers = Arrays.asList(Configuration.getConfig().getString("rtc.storm.zkServers").split(","));
        spoutConfig.zkPort = Configuration.getConfig().getInt("rtc.storm.zkPort");
        spoutConfig.scheme = new SchemeAsMultiScheme(new StringScheme());
        KafkaSpout kafkaSpout = new KafkaSpout(spoutConfig);
        builder.setSpout("MQSpout", kafkaSpout, Configuration.getConfig().getInt("rtc.storm.spout.parallelismHint")).setNumTasks(Configuration.getConfig().getInt("rtc.storm.spout.task"));
        builder.setBolt("ExtractBolt", new ExtractBolt(), Configuration.getConfig().getInt("rtc.storm.extract.bolt.parallelismHint")).setNumTasks(Configuration.getConfig().getInt("rtc.storm.extract.bolt.task")).shuffleGrouping("MQSpout");
        builder.setBolt("Statistic", new StatisticBolt(), Configuration.getConfig().getInt("rtc.storm.statistic.bolt.parallelismHint")).setNumTasks(Configuration.getConfig().getInt("rtc.storm.statistic.bolt.task")).fieldsGrouping("ExtractBolt", new Fields(new String[] { "hashKeys" }));
        // builder.setBolt("Alarm", new AlarmBolt(), Configuration.getConfig().getInt("rtc.storm.alarm.bolt.parallelismHint")).setNumTasks(Configuration.getConfig().getInt("rtc.storm.alarm.bolt.task")).fieldsGrouping("Statistic", new Fields(new String[]{"EventName"}));
        return builder;
    }

    private static void submitTopology(TopologyBuilder builder) {
        try {
            LocalCluster cluster = new LocalCluster();
            config.put(Config.STORM_CLUSTER_MODE, "local");
            cluster.submitTopology(Configuration.getConfig().getString("topology.name"), config, builder.createTopology());
        } catch (Exception e) {
            LOG.error(e.getMessage(), e.getCause());
        }
    }
}

18 View Complete Implementation : FlinkRunner.java
Copyright Apache License 2.0
Author : Xtra-Computing
/**
 * Run the Brisk.topology remotely
 *
 * @param topology     The Brisk.topology to be executed
 * @param topologyName The name of the Brisk.topology
 * @param conf         The Configs for the Brisk.execution
 * @throws AlreadyAliveException
 * @throws InvalidTopologyException
 */
public static void runTopologyRemotely(FlinkTopology topology, String topologyName, Config conf) {
    // conf.registerMetricsConsumer(LoggingMetricsConsumer.clreplaced, 2);
    // conf.setMaxSpoutPending(Conf.getInt("max_pending", 5000));
    // This will simply log all Metrics received into
    // $STORM_HOME/logs/metrics.log on one or more worker nodes.
    // conf.registerMetricsConsumer(LoggingMetricsConsumer.clreplaced, 2);
    // LOG.info("max pending;" + conf.get("Brisk.topology.max.spout.pending"));
    // LOG.info("metrics.output:" + Conf.getString("metrics.output"));
    // LOG.info("NumWorkers:" + Conf.getInt("num_workers"));
    LOG.info("Run with Config:" + conf.values());
    try {
        FlinkSubmitter.submitTopology(topologyName, conf, topology);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

18 View Complete Implementation : RealtimeJoinBolt.java
Copyright Apache License 2.0
Author : hortonworks
@Override
public Map<String, Object> getComponentConfiguration() {
    // We setup tick tuples to expire tuples when one of the streams has time based retention
    // to ensure expiration occurs even if there is no incoming data
    Config conf = new Config();
    if (needTicks())
        conf.put(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, 1);
    return conf;
}

18 View Complete Implementation : ClusterTopology.java
Copyright GNU Lesser General Public License v3.0
Author : JiuzhouSec
/**
 * Created by caodaoxi on 16-4-5.
 */
public clreplaced ClusterTopology {

    private static final Logger LOG = LoggerFactory.getLogger(ClusterTopology.clreplaced);

    private static Config config = new Config();

    public static void main(String[] args) throws Exception {
        Configuration.init("rtc.properties");
        TopologyBuilder builder = buildTopology();
        submitTopology(builder);
    }

    private static TopologyBuilder buildTopology() throws Exception {
        TopologyBuilder builder = new TopologyBuilder();
        String topicName = Configuration.getConfig().getString("rtc.mq.spout.topic");
        String groupName = Configuration.getConfig().getString("rtc.mq.spout.group");
        BrokerHosts hosts = new ZkHosts(Configuration.getConfig().getString("rtc.zk.hosts"));
        SpoutConfig spoutConfig = new SpoutConfig(hosts, topicName, "/consumers", groupName);
        spoutConfig.startOffsetTime = kafka.api.OffsetRequest.LatestTime();
        spoutConfig.zkServers = Arrays.asList(Configuration.getConfig().getString("rtc.storm.zkServers").split(","));
        spoutConfig.zkPort = Configuration.getConfig().getInt("rtc.storm.zkPort");
        spoutConfig.scheme = new SchemeAsMultiScheme(new StringScheme());
        KafkaSpout kafkaSpout = new KafkaSpout(spoutConfig);
        builder.setSpout("MQSpout", kafkaSpout, Configuration.getConfig().getInt("rtc.storm.spout.parallelismHint")).setNumTasks(Configuration.getConfig().getInt("rtc.storm.spout.task"));
        builder.setBolt("ExtractBolt", new ExtractBolt(), Configuration.getConfig().getInt("rtc.storm.extract.bolt.parallelismHint")).setNumTasks(Configuration.getConfig().getInt("rtc.storm.extract.bolt.task")).shuffleGrouping("MQSpout");
        builder.setBolt("Statistic", new StatisticBolt(), Configuration.getConfig().getInt("rtc.storm.statistic.bolt.parallelismHint")).setNumTasks(Configuration.getConfig().getInt("rtc.storm.statistic.bolt.task")).fieldsGrouping("ExtractBolt", new Fields(new String[] { "hashKeys" }));
        // builder.setBolt("Alarm", new AlarmBolt(), Configuration.getConfig().getInt("rtc.storm.alarm.bolt.parallelismHint")).setNumTasks(Configuration.getConfig().getInt("rtc.storm.alarm.bolt.task")).fieldsGrouping("Statistic", new Fields(new String[]{"EventName"}));
        return builder;
    }

    private static void submitTopology(TopologyBuilder builder) {
        try {
            config.put(Config.STORM_CLUSTER_MODE, "distributed");
            config.setNumWorkers(Configuration.getConfig().getInt("rtc.storm.worker"));
            StormSubmitter.submitTopology(Configuration.getConfig().getString("topology.name"), config, builder.createTopology());
        } catch (AlreadyAliveException e) {
            LOG.error(e.getMessage(), e.getCause());
        } catch (InvalidTopologyException e) {
            LOG.error(e.getMessage(), e.getCause());
        } catch (Exception e) {
            LOG.error(e.getMessage(), e.getCause());
        }
    }
}

18 View Complete Implementation : KafkaStormIntegrationTest.java
Copyright Apache License 2.0
Author : apache
private TestJob createPirkTestJob(final Config config) {
    final SpoutConfig kafkaConfig = setUpTestKafkaSpout(config);
    return new TestJob() {

        StormTopology topology = PirkTopology.getPirkTopology(kafkaConfig);

        @Override
        public void run(ILocalCluster iLocalCluster) throws Exception {
            iLocalCluster.submitTopology("pirk_integration_test", config, topology);
            logger.info("Pausing for setup.");
            // Thread.sleep(4000);
            // KafkaProducer producer = new KafkaProducer<String,String>(createKafkaProducerConfig());
            // loadTestData(producer);
            // Thread.sleep(10000);
            while (OutputBolt.latch.getCount() == testCountDown) {
                Thread.sleep(1000);
            }
            testCountDown -= 1;
            logger.info("Finished...");
        }
    };
}

18 View Complete Implementation : TopologyModule.java
Copyright Apache License 2.0
Author : openstack
/**
 * Configures types for the thresholding topology.
 */
public clreplaced TopologyModule extends AbstractModule {

    private final ThresholdingConfiguration config;

    private Config stormConfig;

    private IRichSpout metricSpout;

    private IRichSpout eventSpout;

    public TopologyModule(ThresholdingConfiguration config) {
        this.config = config;
    }

    public TopologyModule(ThresholdingConfiguration threshConfig, Config stormConfig, IRichSpout metricSpout, IRichSpout eventSpout) {
        this(threshConfig);
        this.stormConfig = stormConfig;
        this.metricSpout = metricSpout;
        this.eventSpout = eventSpout;
    }

    @Override
    protected void configure() {
    }

    @Provides
    Config stormConfig() {
        if (stormConfig == null) {
            stormConfig = new Config();
            stormConfig.setNumWorkers(config.numWorkerProcesses);
            stormConfig.setNumAckers(config.numAckerThreads);
            /* Configure the StatsdMetricConsumer */
            java.util.Map<Object, Object> statsdConfig = new java.util.HashMap<>();
            /*
       * Catch the case where the config file was not updated
       * in /etc/monasca/thresh-config.yml
       * note that you get default values if these are absent
       */
            if (config.statsdConfig.getHost() != null)
                statsdConfig.put(StatsdMetricConsumer.STATSD_HOST, config.statsdConfig.getHost());
            if (config.statsdConfig.getPort() != null)
                statsdConfig.put(StatsdMetricConsumer.STATSD_PORT, config.statsdConfig.getPort());
            if (config.statsdConfig.getWhitelist() != null)
                statsdConfig.put(StatsdMetricConsumer.STATSD_WHITELIST, config.statsdConfig.getWhitelist());
            if (config.statsdConfig.getMetricmap() != null)
                statsdConfig.put(StatsdMetricConsumer.STATSD_METRICMAP, config.statsdConfig.getMetricmap());
            if (config.statsdConfig.getDimensions() != null)
                statsdConfig.put(StatsdMetricConsumer.STATSD_DIMENSIONS, config.statsdConfig.getDimensions());
            if (config.statsdConfig.getDebugmetrics() != null)
                statsdConfig.put(StatsdMetricConsumer.STATSD_DEBUGMETRICS, config.statsdConfig.getDebugmetrics());
            stormConfig.registerMetricsConsumer(StatsdMetricConsumer.clreplaced, statsdConfig, 2);
        }
        return stormConfig;
    }

    @Provides
    @Named("metrics")
    IRichSpout metricSpout() {
        return metricSpout == null ? new MetricSpout(config.metricSpoutConfig) : metricSpout;
    }

    @Provides
    @Named("event")
    IRichSpout eventSpout() {
        return eventSpout == null ? new EventSpout(config.eventSpoutConfig, new EventDeserializer()) : eventSpout;
    }

    @Provides
    StormTopology topology() {
        TopologyBuilder builder = new TopologyBuilder();
        // Receives metrics
        builder.setSpout("metrics-spout", Injector.getInstance(IRichSpout.clreplaced, "metrics"), config.metricSpoutThreads).setNumTasks(config.metricSpoutTasks);
        // Receives events
        builder.setSpout("event-spout", Injector.getInstance(IRichSpout.clreplaced, "event"), config.eventSpoutThreads).setNumTasks(config.eventSpoutTasks);
        // Event -> Events
        builder.setBolt("event-bolt", new EventProcessingBolt(config.database), config.eventBoltThreads).shuffleGrouping("event-spout").setNumTasks(config.eventBoltTasks);
        // Metrics / Event -> Filtering
        builder.setBolt("filtering-bolt", new MetricFilteringBolt(config.database), config.filteringBoltThreads).fieldsGrouping("metrics-spout", new Fields(MetricSpout.FIELDS[0])).allGrouping("event-bolt", EventProcessingBolt.METRIC_ALARM_EVENT_STREAM_ID).allGrouping("event-bolt", EventProcessingBolt.ALARM_DEFINITION_EVENT_STREAM_ID).setNumTasks(config.filteringBoltTasks);
        // Filtering /Event -> Alarm Creation
        builder.setBolt("alarm-creation-bolt", new AlarmCreationBolt(config.database), config.alarmCreationBoltThreads).fieldsGrouping("filtering-bolt", MetricFilteringBolt.NEW_METRIC_FOR_ALARM_DEFINITION_STREAM, new Fields(AlarmCreationBolt.ALARM_CREATION_FIELDS[3])).allGrouping("event-bolt", EventProcessingBolt.METRIC_SUB_ALARM_EVENT_STREAM_ID).allGrouping("event-bolt", EventProcessingBolt.ALARM_EVENT_STREAM_ID).allGrouping("event-bolt", EventProcessingBolt.ALARM_DEFINITION_EVENT_STREAM_ID).setNumTasks(config.alarmCreationBoltTasks);
        // Filtering / Event / Alarm Creation -> Aggregation
        builder.setBolt("aggregation-bolt", new MetricAggregationBolt(config, config.database), config.aggregationBoltThreads).fieldsGrouping("filtering-bolt", new Fields(MetricFilteringBolt.FIELDS[0])).allGrouping("filtering-bolt", MetricAggregationBolt.METRIC_AGGREGATION_CONTROL_STREAM).fieldsGrouping("filtering-bolt", AlarmCreationBolt.ALARM_CREATION_STREAM, new Fields(AlarmCreationBolt.ALARM_CREATION_FIELDS[1])).allGrouping("event-bolt", EventProcessingBolt.METRIC_SUB_ALARM_EVENT_STREAM_ID).fieldsGrouping("event-bolt", EventProcessingBolt.METRIC_ALARM_EVENT_STREAM_ID, new Fields(EventProcessingBolt.METRIC_ALARM_EVENT_STREAM_FIELDS[1])).fieldsGrouping("alarm-creation-bolt", AlarmCreationBolt.ALARM_CREATION_STREAM, new Fields(AlarmCreationBolt.ALARM_CREATION_FIELDS[1])).setNumTasks(config.aggregationBoltTasks);
        // Alarm Creation / Event
        // Aggregation / Event -> Thresholding
        builder.setBolt("thresholding-bolt", new AlarmThresholdingBolt(config.database, config.kafkaProducerConfig), config.thresholdingBoltThreads).fieldsGrouping("aggregation-bolt", new Fields(MetricAggregationBolt.FIELDS[0])).fieldsGrouping("event-bolt", EventProcessingBolt.ALARM_EVENT_STREAM_ID, new Fields(EventProcessingBolt.ALARM_EVENT_STREAM_FIELDS[1])).allGrouping("event-bolt", EventProcessingBolt.ALARM_DEFINITION_EVENT_STREAM_ID).allGrouping("event-bolt", EventProcessingBolt.METRIC_SUB_ALARM_EVENT_STREAM_ID).setNumTasks(config.thresholdingBoltTasks);
        return builder.createTopology();
    }
}

18 View Complete Implementation : RandomNumberGeneratorSpout.java
Copyright Apache License 2.0
Author : ziyunhx
@Override
public Map<String, Object> getComponentConfiguration() {
    Config conf = new Config();
    conf.setMaxTaskParallelism(1);
    return conf;
}

18 View Complete Implementation : StormLocalCluster.java
Copyright Apache License 2.0
Author : sakserv
public void submitTopology(String topologyName, Config conf, StormTopology topology) throws AlreadyAliveException, InvalidTopologyException {
    localCluster.submitTopology(topologyName, conf, topology);
}

18 View Complete Implementation : ReflectionUtils.java
Copyright Apache License 2.0
Author : bullet-db
/**
 * Creates an instance of a custom {@link IMetricsConsumer} to add for custom metrics logging for the topology. It
 * then calls a static method with the signature register({@link Config}, {@link BulletStormConfig}) to let that
 * clreplaced define any custom metrics and parallelisms etc using the {@link BulletStormConfig} into the Storm
 * {@link Config}.
 *
 * @param clreplacedName The name of the custom {@link IMetricsConsumer}.
 * @param stormConfig The Storm configuration that would be used by the register method.
 * @param bulletConfig The Bullet configuration to preplaced to the register method.
 */
public static void registerMetricsConsumer(String clreplacedName, Config stormConfig, BulletStormConfig bulletConfig) {
    try {
        Clreplaced<? extends IMetricsConsumer> consumer = (Clreplaced<? extends IMetricsConsumer>) Clreplaced.forName(clreplacedName);
        Method method = consumer.getMethod(REGISTER_METHOD, Config.clreplaced, BulletStormConfig.clreplaced);
        log.info("Calling the IMetricsConsumer register method for clreplaced {} using method {}", clreplacedName, method.toGenericString());
        method.invoke(null, stormConfig, bulletConfig);
        log.info("Registered the IMetricsConsumer clreplaced {}", clreplacedName);
    } catch (Exception e) {
        log.info("Could not call the register method for " + clreplacedName, e);
    }
}

18 View Complete Implementation : OpenTSDBFilterBolt.java
Copyright Apache License 2.0
Author : telstra
@Override
public Map<String, Object> getComponentConfiguration() {
    Config conf = new Config();
    conf.put(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, MUTE_IF_NO_UPDATES_SECS);
    return conf;
}

18 View Complete Implementation : RulesTopologyTest.java
Copyright Apache License 2.0
Author : hortonworks
protected Config getConfig() {
    final Config config = new Config();
    config.setDebug(true);
    return config;
}

18 View Complete Implementation : CustomIMetricsConsumer.java
Copyright Apache License 2.0
Author : bullet-db
public static void register(Config stormConfig, BulletStormConfig bulletStormConfig) {
    bulletStormConfig.set(CUSTOM_METRICS_REGISTERED, true);
    stormConfig.registerMetricsConsumer(CustomIMetricsConsumer.clreplaced);
}

18 View Complete Implementation : FastWordCountTopology.java
Copyright Apache License 2.0
Author : alibaba
/**
 * WordCount but teh spout does not stop, and the bolts are implemented in java.
 * This can show how fast the word count can run.
 */
public clreplaced FastWordCountTopology {

    private static Logger LOG = LoggerFactory.getLogger(FastWordCountTopology.clreplaced);

    public final static String TOPOLOGY_SPOUT_PARALLELISM_HINT = "topology.spout.parallel";

    public final static String TOPOLOGY_SPLIT_PARALLELISM_HINT = "topology.bolt.parallel";

    public final static String TOPOLOGY_COUNT_PARALLELISM_HINT = "topology.bolt.parallel";

    public static clreplaced FastRandomSentenceSpout implements IRichSpout {

        SpoutOutputCollector _collector;

        Random _rand;

        long sendingCount;

        long startTime;

        boolean isStatEnable;

        int sendNumPerNexttuple;

        private static final String[] CHOICES = { "marry had a little lamb whos fleese was white as snow", "and every where that marry went the lamb was sure to go", "one two three four five six seven eight nine ten", "this is a test of the emergency broadcast system this is only a test", "peter piper picked a peck of pickeled peppers" };

        public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {
            _collector = collector;
            _rand = new Random();
            sendingCount = 0;
            startTime = System.currentTimeMillis();
            sendNumPerNexttuple = Utils.getInt(conf.get("send.num.each.time"), 1);
            isStatEnable = Utils.getBoolean(conf.get("is.stat.enable"), false);
        }

        public void nextTuple() {
            int n = sendNumPerNexttuple;
            while (--n >= 0) {
                String sentence = CHOICES[_rand.nextInt(CHOICES.length)];
                _collector.emit(new Values(sentence));
            }
            updateSendTps();
        }

        public void ack(Object id) {
        // Ignored
        }

        public void fail(Object id) {
            _collector.emit(new Values(id), id);
        }

        public void declareOutputFields(OutputFieldsDeclarer declarer) {
            declarer.declare(new Fields("sentence"));
        }

        private void updateSendTps() {
            if (!isStatEnable)
                return;
            sendingCount++;
            long now = System.currentTimeMillis();
            long interval = now - startTime;
            if (interval > 60 * 1000) {
                LOG.info("Sending tps of last one minute is " + (sendingCount * sendNumPerNexttuple * 1000) / interval);
                startTime = now;
                sendingCount = 0;
            }
        }

        public void close() {
        // TODO Auto-generated method stub
        }

        public void activate() {
        // TODO Auto-generated method stub
        }

        public void deactivate() {
        // TODO Auto-generated method stub
        }

        public Map<String, Object> getComponentConfiguration() {
            // TODO Auto-generated method stub
            return null;
        }
    }

    public static clreplaced SplitSentence implements IRichBolt {

        OutputCollector collector;

        public void execute(Tuple tuple) {
            String sentence = tuple.getString(0);
            for (String word : sentence.split("\\s+")) {
                collector.emit(new Values(word));
            }
        }

        public void declareOutputFields(OutputFieldsDeclarer declarer) {
            declarer.declare(new Fields("word"));
        }

        public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) {
            this.collector = collector;
        }

        public void cleanup() {
        // TODO Auto-generated method stub
        }

        public Map<String, Object> getComponentConfiguration() {
            // TODO Auto-generated method stub
            return null;
        }
    }

    public static clreplaced WordCount implements IRichBolt {

        OutputCollector collector;

        Map<String, Integer> counts = new HashMap<String, Integer>();

        public void execute(Tuple tuple) {
            String word = tuple.getString(0);
            Integer count = counts.get(word);
            if (count == null)
                count = 0;
            counts.put(word, ++count);
        }

        public void declareOutputFields(OutputFieldsDeclarer declarer) {
        }

        public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) {
            this.collector = collector;
        }

        public void cleanup() {
        // TODO Auto-generated method stub
        }

        public Map<String, Object> getComponentConfiguration() {
            // TODO Auto-generated method stub
            return null;
        }
    }

    static boolean isLocal = true;

    static Config conf = null;

    public static void test() throws Exception {
        int spout_Parallelism_hint = Utils.getInt(conf.get(TOPOLOGY_SPOUT_PARALLELISM_HINT), 1);
        int split_Parallelism_hint = Utils.getInt(conf.get(TOPOLOGY_SPLIT_PARALLELISM_HINT), 1);
        int count_Parallelism_hint = Utils.getInt(conf.get(TOPOLOGY_COUNT_PARALLELISM_HINT), 2);
        TopologyBuilder builder = new TopologyBuilder();
        builder.setSpout("spout", new FastRandomSentenceSpout(), spout_Parallelism_hint);
        builder.setBolt("split", new SplitSentence(), split_Parallelism_hint).shuffleGrouping("spout");
        builder.setBolt("count", new WordCount(), count_Parallelism_hint).fieldsGrouping("split", new Fields("word"));
        String[] clreplacedName = Thread.currentThread().getStackTrace()[1].getClreplacedName().split("\\.");
        String topologyName = clreplacedName[clreplacedName.length - 1];
        StormSubmitter.submitTopology(topologyName, conf, builder.createTopology());
    }

    public static void main(String[] args) throws Exception {
        conf = com.alibaba.jstorm.utils.Utils.getConfig(args);
        test();
    }
}

18 View Complete Implementation : AbstractTickRichBolt.java
Copyright Apache License 2.0
Author : telstra
/*
     * Configure frequency of tick tuples for this bolt. This delivers a 'tick' tuple on a specific
     * interval, which is used to trigger certain actions
     */
@Override
public Map<String, Object> getComponentConfiguration() {
    Config conf = new Config();
    conf.put(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, emitFrequency);
    return conf;
}

17 View Complete Implementation : HeronRunner.java
Copyright Apache License 2.0
Author : Xtra-Computing
public clreplaced HeronRunner extends abstractRunner {

    private static final Logger LOG = LoggerFactory.getLogger(HeronRunner.clreplaced);

    public static LocalCluster cluster;

    private final AppDriver driver;

    public Config config = new Config();

    public HeronRunner() {
        driver = new AppDriver();
        // driver.addApp("Streamingreplacedysis", Streamingreplacedysis.clreplaced);//Extra
        driver.addApp("WordCount", WordCount.clreplaced);
        driver.addApp("FraudDetection", FraudDetection.clreplaced);
        driver.addApp("SpikeDetection", SpikeDetection.clreplaced);
        // driver.addApp("TrafficMonitoring", TrafficMonitoring.clreplaced);
        driver.addApp("LogProcessing", LogProcessing.clreplaced);
        driver.addApp("VoIPSTREAM", VoIPSTREAM.clreplaced);
        // 
        driver.addApp("LinearRoad", LinearRoad.clreplaced);
    }

    public static void main(String[] args) {
        HeronRunner runner = new HeronRunner();
        JCommander cmd = new JCommander(runner);
        // Kryo kryo = new Kryo();
        // kryo.register(java.utils.Date.clreplaced);
        // 
        try {
            cmd.parse(args);
        } catch (ParameterException ex) {
            System.err.println("Argument error: " + ex.getMessage());
            cmd.usage();
            System.exit(1);
        }
        try {
            runner.run();
        } catch (AlreadyAliveException | InvalidTopologyException ex) {
            LOG.error("Error in running Brisk.topology remotely", ex);
        } catch (InterruptedException ex) {
            LOG.error("Error in running Brisk.topology locally", ex);
        }
    }

    /**
     * Run the Brisk.topology locally
     *
     * @param topology         The Brisk.topology to be executed
     * @param topologyName     The name of the Brisk.topology
     * @param conf             The configurations for the Brisk.execution
     * @param runtimeInSeconds For how much time the Brisk.topology will run
     * @throws InterruptedException
     */
    public static void runTopologyLocally(StormTopology topology, String topologyName, Config conf, int runtimeInSeconds) throws InterruptedException, AlreadyAliveException, InvalidTopologyException {
        Configuration Conf = Configuration.fromMap(conf);
        conf.setMaxSpoutPending(Conf.getInt("max_pending", 5000));
        // conf.put("compatibility.zookeeper.session.timeout", 300000);
        conf.put(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT, 300000);
        LOG.info("Starting Storm on local mode to run for {} seconds", runtimeInSeconds);
        cluster = new LocalCluster();
        LOG.info("Topology {} submitted", topologyName);
        cluster.submitTopology(topologyName, conf, topology);
        Thread.sleep((long) runtimeInSeconds * 1000);
        cluster.shutdown();
    }

    /**
     * Run the Brisk.topology remotely
     *
     * @param topology     The Brisk.topology to be executed
     * @param topologyName The name of the Brisk.topology
     * @param conf         The configurations for the Brisk.execution
     * @throws AlreadyAliveException
     * @throws InvalidTopologyException
     */
    public static void runTopologyRemotely(StormTopology topology, String topologyName, Config conf) {
        // conf.registerMetricsConsumer(LoggingMetricsConsumer.clreplaced, 2);
        Configuration Conf = Configuration.fromMap(conf);
        // conf.setMaxSpoutPending(Conf.getInt("max_pending", 5000));
        // This will simply log all Metrics received into
        // $STORM_HOME/logs/metrics.log on one or more worker nodes.
        // conf.registerMetricsConsumer(LoggingMetricsConsumer.clreplaced, 2);
        // LOG.info("max pending;" + conf.get("Brisk.topology.max.spout.pending"));
        // LOG.info("metrics.output:" + Conf.getString("metrics.output"));
        // LOG.info("NumWorkers:" + Conf.getInt("num_workers"));
        LOG.info("Run with configuration:" + conf.values());
        try {
            StormSubmitter.submitTopology(topologyName, conf, topology);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void run() throws InterruptedException, AlreadyAliveException, InvalidTopologyException {
        // Loads the configuration file set by the user or the default
        // configuration
        try {
            // load default configuration
            if (configStr == null) {
                String cfg = String.format(CFG_PATH, application);
                Properties p = loadProperties(cfg, (configStr == null));
                config.put(BaseConstants.BaseConf.SPOUT_THREADS, sthread);
                config.put(BaseConstants.BaseConf.SINK_THREADS, sithread);
                config.putAll(Configuration.fromProperties(p));
                if (mode.equalsIgnoreCase(RUN_REMOTE)) {
                    final String spout_clreplaced = String.valueOf(config.get("mb.spout.clreplaced"));
                    if (spout_clreplaced.equals("applications.spout.LocalStateSpout")) {
                        LOG.info("Please use kafkaSpout in cluster mode!!!");
                        System.exit(-1);
                    }
                }
                config.setDebug(false);
                config.put(Config.TOPOLOGY_WORKER_CHILDOPTS, CHILDOPTS);
                configuration(config);
            } else {
                config.putAll(Configuration.fromStr(configStr));
                LOG.info("Loaded configuration from command line argument");
            }
        } catch (IOException ex) {
            LOG.error("Unable to load configuration file", ex);
            throw new RuntimeException("Unable to load configuration file", ex);
        }
        // Get the descriptor for the given application
        AppDriver.AppDescriptor app = driver.getApp(application);
        if (app == null) {
            throw new RuntimeException("The given application name " + application + " is invalid");
        }
        // In case no Brisk.topology names is given, create one
        if (topologyName == null) {
            topologyName = application;
        }
        config.put(BaseConstants.BaseConf.SPOUT_THREADS, sthread);
        config.put(BaseConstants.BaseConf.SINK_THREADS, sithread);
        config.put(BaseConstants.BaseConf.PARSER_THREADS, pthread);
        // set total parallelism, equally parallelism
        int max_hz = 0;
        switch(application) {
            case "Streamingreplacedysis":
                {
                    int threads = (int) Math.ceil(tthread / 5.0);
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    config.put(streamingreplacedysisConstants.Conf.EXECUTOR_THREADS1, threads);
                    config.put(streamingreplacedysisConstants.Conf.EXECUTOR_THREADS2, threads);
                    config.put(streamingreplacedysisConstants.Conf.EXECUTOR_THREADS3, threads);
                    config.put(streamingreplacedysisConstants.Conf.EXECUTOR_THREADS4, threads);
                    break;
                }
            case "WordCount":
                {
                    // config.put(BaseConstants.BaseConf.SPOUT_THREADS, 2);//special treatment to WC>
                    int threads = (int) Math.ceil(tthread / 3.0);
                    LOG.info("Average threads:" + threads);
                    // insignificant
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    // 2
                    config.put(WordCountConstants.Conf.SPLITTER_THREADS, threads);
                    config.put(WordCountConstants.Conf.COUNTER_THREADS, threads);
                    max_hz = WordCountConstants.max_hz;
                    break;
                }
            case "FraudDetection":
                {
                    // special treatment to FD>
                    config.put(BaseConstants.BaseConf.SPOUT_THREADS, 16);
                    int threads = (int) Math.ceil(tthread / 2.0);
                    // insignificant
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    config.put(FraudDetectionConstants.Conf.PREDICTOR_THREADS, threads);
                    max_hz = FraudDetectionConstants.max_hz;
                    break;
                }
            case "SpikeDetection":
                {
                    // config.put(BaseConstants.BaseConf.SPOUT_THREADS, 1);//special treatment to SD>
                    int threads = (int) Math.ceil(tthread / 3.0);
                    LOG.info("Average threads:" + threads);
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    // insignificant
                    config.put(SpikeDetectionConstants.Conf.MOVING_AVERAGE_THREADS, threads);
                    // insignificant
                    config.put(SpikeDetectionConstants.Conf.SPIKE_DETECTOR_THREADS, threads);
                    max_hz = SpikeDetectionConstants.max_hz;
                    break;
                }
            // case "TrafficMonitoring": {
            // int threads = tthread / 1;
            // //                        config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
            // config.put(TrafficMonitoringConstants.Conf.MAP_MATCHER_THREADS, threads);//*5
            // //                        config.put(TrafficMonitoringConstants.Conf.SPEED_CALCULATOR_THREADS, threads);
            // max_hz = TrafficMonitoringConstants.max_hz;
            // break;
            // }
            case "LogProcessing":
                {
                    // special treatment to LG>
                    config.put(BaseConstants.BaseConf.SPOUT_THREADS, 1);
                    int threads = (int) Math.ceil(tthread / 5.0);
                    LOG.info("Average threads:" + threads);
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    // 2
                    config.put(LogProcessingConstants.Conf.GEO_FINDER_THREADS, threads);
                    // insignificant
                    config.put(LogProcessingConstants.Conf.GEO_STATS_THREADS, threads);
                    // insignificant
                    config.put(LogProcessingConstants.Conf.STATUS_COUNTER_THREADS, threads);
                    // insignificant
                    config.put(LogProcessingConstants.Conf.VOLUME_COUNTER_THREADS, threads);
                    break;
                }
            case "VoIPSTREAM":
                {
                    int threads = (int) Math.ceil(tthread / 11.0);
                    LOG.info("Average threads:" + threads);
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    config.put(VoIPSTREAMConstants.Conf.VAR_DETECT_THREADS, threads);
                    // 2
                    config.put(VoIPSTREAMConstants.Conf.RCR_THREADS, threads);
                    // 2
                    config.put(VoIPSTREAMConstants.Conf.ECR_THREADS, threads);
                    // insignificant
                    config.put(VoIPSTREAMConstants.Conf.ENCR_THREADS, threads);
                    // insignificant
                    config.put(VoIPSTREAMConstants.Conf.CT24_THREADS, threads);
                    config.put(VoIPSTREAMConstants.Conf.ECR24_THREADS, threads);
                    // config.put(VoIPSTREAMConstants.Conf.GLOBAL_ACD, threads); 1
                    // 2
                    config.put(VoIPSTREAMConstants.Conf.FOFIR_THREADS, threads);
                    config.put(VoIPSTREAMConstants.Conf.URL_THREADS, threads);
                    config.put(VoIPSTREAMConstants.Conf.ACD_THREADS, threads);
                    config.put(VoIPSTREAMConstants.Conf.SCORER_THREADS, threads);
                    break;
                }
            case "LinearRoad":
                {
                    // config.put(BaseConstants.BaseConf.SPOUT_THREADS, 2);//special treatment to LR>
                    int threads = (int) Math.ceil(tthread / 7.0);
                    LOG.info("Average threads:" + threads);
                    config.put(LinearRoadConstants.Conf.DispatcherBoltThreads, threads);
                    // insignificant
                    config.put(LinearRoadConstants.Conf.accidentBoltThreads, threads);
                    // insignificant
                    config.put(LinearRoadConstants.Conf.CountThreads, threads);
                    // insignificant
                    config.put(LinearRoadConstants.Conf.dailyExpBoltThreads, threads);
                    // insignificant
                    config.put(LinearRoadConstants.Conf.AccidentNotificationBoltThreads, threads);
                    // insignificant
                    config.put(LinearRoadConstants.Conf.tollBoltThreads, threads);
                    config.put(LinearRoadConstants.Conf.AccountBalanceBoltThreads, threads);
                    break;
                }
        }
        config.registerSerialization(java.util.Date.clreplaced);
        // config.registerSerialization(org.apache.compatibility.tuple.TupleImpl.clreplaced);
        // Get the Brisk.topology and execute on Storm
        StormTopology stormTopology = app.getTopology(topologyName, config);
        config.put("Brisk.topology.acker.executors", 0);
        switch(mode) {
            case RUN_LOCAL:
                runTopologyLocally(stormTopology, topologyName, config, runtimeInSeconds * 2);
                break;
            case RUN_REMOTE:
                runTopologyRemotely(stormTopology, topologyName, config);
                break;
            default:
                throw new RuntimeException("Valid running modes are 'local' and 'remote'");
        }
    }
}

17 View Complete Implementation : StormRunner.java
Copyright Apache License 2.0
Author : Xtra-Computing
// import applications.Brisk.topology.special_LRF.toll.MemoryTollDataStore;
// import applications.Brisk.topology.special_LRF.tools.Helper;
public clreplaced StormRunner extends abstractRunner {

    private static final Logger LOG = LoggerFactory.getLogger(StormRunner.clreplaced);

    public static LocalCluster cluster;

    private final AppDriver driver;

    public Config config = new Config();

    public StormRunner() {
        driver = new AppDriver();
        // driver.addApp("Streamingreplacedysis", Streamingreplacedysis.clreplaced);//Extra
        driver.addApp("WordCount", WordCount.clreplaced);
        driver.addApp("FraudDetection", FraudDetection.clreplaced);
        driver.addApp("SpikeDetection", SpikeDetection.clreplaced);
        // driver.addApp("TrafficMonitoring", TrafficMonitoring.clreplaced);
        driver.addApp("LogProcessing", LogProcessing.clreplaced);
        // driver.addApp("VoIPSTREAM", VoIPSTREAM.clreplaced);
        // 
        driver.addApp("LinearRoad", LinearRoad.clreplaced);
        driver.addApp("WordCount_latency", WordCount_latency.clreplaced);
        driver.addApp("FraudDetection_latency", FraudDetection_latency.clreplaced);
        driver.addApp("SpikeDetection_latency", SpikeDetection_latency.clreplaced);
        driver.addApp("LogProcessing_latency", LogProcessing_latency.clreplaced);
        // 
        driver.addApp("LinearRoad_latency", LinearRoad_latency.clreplaced);
    }

    public static void main(String[] args) {
        StormRunner runner = new StormRunner();
        JCommander cmd = new JCommander(runner);
        try {
            cmd.parse(args);
        } catch (ParameterException ex) {
            System.err.println("Argument error: " + ex.getMessage());
            cmd.usage();
            System.exit(1);
        }
        try {
            runner.run();
        } catch (InterruptedException ex) {
            LOG.error("Error in running Brisk.topology locally", ex);
        }
    }

    /**
     * Run the topology locally
     *
     * @param topology         The Brisk.topology to be executed
     * @param topologyName     The name of the Brisk.topology
     * @param conf             The configurations for the Brisk.execution
     * @param runtimeInSeconds For how much time the Brisk.topology will run
     * @throws InterruptedException
     */
    public static void runTopologyLocally(StormTopology topology, String topologyName, Config conf, int runtimeInSeconds) throws InterruptedException {
        Configuration Conf = Configuration.fromMap(conf);
        conf.setMaxSpoutPending(Conf.getInt("max_pending", 5000));
        // conf.put("compatibility.zookeeper.session.timeout", 300000);
        conf.put(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT, 300000);
        conf.put(NIMBUS_BLOBSTORE_EXPIRATION_SECS, 300000);
        LOG.info("Starting Storm on local mode to run for {} seconds", runtimeInSeconds);
        cluster = new LocalCluster();
        LOG.info("Topology {} submitted", topologyName);
        cluster.submitTopology(topologyName, conf, topology);
        Thread.sleep((long) runtimeInSeconds * 1000);
        cluster.shutdown();
    }

    /**
     * Run the Brisk.topology remotely
     *
     * @param topology     The Brisk.topology to be executed
     * @param topologyName The name of the Brisk.topology
     * @param conf         The configurations for the Brisk.execution
     * @throws AlreadyAliveException
     * @throws InvalidTopologyException
     */
    public static void runTopologyRemotely(StormTopology topology, String topologyName, Config conf) {
        // conf.registerMetricsConsumer(LoggingMetricsConsumer.clreplaced, 2);
        Configuration Conf = Configuration.fromMap(conf);
        // conf.setMaxSpoutPending(Conf.getInt("max_pending", 5000));
        // This will simply log all Metrics received into
        // $STORM_HOME/logs/metrics.log on one or more worker nodes.
        // conf.registerMetricsConsumer(LoggingMetricsConsumer.clreplaced, 2);
        // LOG.info("max pending;" + conf.get("Brisk.topology.max.spout.pending"));
        // LOG.info("metrics.output:" + Conf.getString("metrics.output"));
        // LOG.info("NumWorkers:" + Conf.getInt("num_workers"));
        LOG.info("Run with configuration:" + conf.values());
        try {
            StormSubmitter.submitTopology(topologyName, conf, topology);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void run() throws InterruptedException {
        // Loads the configuration file set by the user or the default
        // configuration
        try {
            // load default configuration
            if (configStr == null) {
                String cfg = String.format(CFG_PATH, application);
                Properties p = loadProperties(cfg);
                config.put(BaseConstants.BaseConf.SPOUT_THREADS, sthread);
                config.put(BaseConstants.BaseConf.SINK_THREADS, sithread);
                config.putAll(Configuration.fromProperties(p));
                if (mode.equalsIgnoreCase(RUN_REMOTE)) {
                    final String spout_clreplaced = String.valueOf(config.get("mb.spout.clreplaced"));
                    if (spout_clreplaced.equals("applications.spout.LocalStateSpout")) {
                        LOG.info("Please use kafkaSpout in cluster mode!!!");
                        System.exit(-1);
                    }
                }
                config.setDebug(false);
                config.put(Config.TOPOLOGY_WORKER_CHILDOPTS, CHILDOPTS);
                configuration(config);
            } else {
                config.putAll(Configuration.fromStr(configStr));
                LOG.info("Loaded configuration from command line argument");
            }
        } catch (IOException ex) {
            LOG.error("Unable to load configuration file", ex);
            throw new RuntimeException("Unable to load configuration file", ex);
        }
        // Get the descriptor for the given application
        AppDriver.AppDescriptor app = driver.getApp(application);
        if (app == null) {
            throw new RuntimeException("The given application name " + application + " is invalid");
        }
        // In case no Brisk.topology names is given, create one
        if (topologyName == null) {
            topologyName = application;
        }
        config.put(BaseConstants.BaseConf.SPOUT_THREADS, sthread);
        config.put(BaseConstants.BaseConf.SINK_THREADS, sithread);
        config.put(BaseConstants.BaseConf.PARSER_THREADS, pthread);
        int tthread = (int) config.get("tthread");
        // set total parallelism, equally parallelism
        int max_hz = 0;
        switch(application) {
            case "Streamingreplacedysis":
                {
                    int threads = (int) Math.ceil(tthread / 5.0);
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    config.put(streamingreplacedysisConstants.Conf.EXECUTOR_THREADS1, threads);
                    config.put(streamingreplacedysisConstants.Conf.EXECUTOR_THREADS2, threads);
                    config.put(streamingreplacedysisConstants.Conf.EXECUTOR_THREADS3, threads);
                    config.put(streamingreplacedysisConstants.Conf.EXECUTOR_THREADS4, threads);
                    break;
                }
            case "WordCount":
            case "WordCount_latency":
                {
                    // config.put(BaseConstants.BaseConf.SPOUT_THREADS, 2);//special treatment to WC>
                    int threads = (int) Math.ceil(tthread / 3.0);
                    LOG.info("Average threads:" + threads);
                    // insignificant
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    // 2
                    config.put(WordCountConstants.Conf.SPLITTER_THREADS, threads);
                    config.put(WordCountConstants.Conf.COUNTER_THREADS, threads);
                    max_hz = WordCountConstants.max_hz;
                    break;
                }
            case "FraudDetection":
                {
                    // config.put(BaseConstants.BaseConf.SPOUT_THREADS, 16);//special treatment to FD>
                    int threads = Math.max(1, (int) Math.floor((tthread - sthread - sithread) / 2.0));
                    // insignificant
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    config.put(FraudDetectionConstants.Conf.PREDICTOR_THREADS, threads);
                    max_hz = FraudDetectionConstants.max_hz;
                    break;
                }
            case "SpikeDetection":
                {
                    // config.put(BaseConstants.BaseConf.SPOUT_THREADS, 1);//special treatment to SD>
                    int threads = (int) Math.ceil(tthread / 3.0);
                    LOG.info("Average threads:" + threads);
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    // insignificant
                    config.put(SpikeDetectionConstants.Conf.MOVING_AVERAGE_THREADS, threads);
                    // insignificant
                    config.put(SpikeDetectionConstants.Conf.SPIKE_DETECTOR_THREADS, threads);
                    max_hz = SpikeDetectionConstants.max_hz;
                    break;
                }
            // case "TrafficMonitoring": {
            // int threads = tthread / 1;
            // //                        config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
            // config.put(TrafficMonitoringConstants.Conf.MAP_MATCHER_THREADS, threads);//*5
            // //                        config.put(TrafficMonitoringConstants.Conf.SPEED_CALCULATOR_THREADS, threads);
            // max_hz = TrafficMonitoringConstants.max_hz;
            // break;
            // }
            case "LogProcessing":
                {
                    // special treatment to LG>
                    config.put(BaseConstants.BaseConf.SPOUT_THREADS, 1);
                    int threads = (int) Math.ceil(tthread / 5.0);
                    LOG.info("Average threads:" + threads);
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    // 2
                    config.put(LogProcessingConstants.Conf.GEO_FINDER_THREADS, threads);
                    // insignificant
                    config.put(LogProcessingConstants.Conf.GEO_STATS_THREADS, threads);
                    // insignificant
                    config.put(LogProcessingConstants.Conf.STATUS_COUNTER_THREADS, threads);
                    // insignificant
                    config.put(LogProcessingConstants.Conf.VOLUME_COUNTER_THREADS, threads);
                    break;
                }
            case "VoIPSTREAM":
                {
                    int threads = (int) Math.ceil(tthread / 11.0);
                    LOG.info("Average threads:" + threads);
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    config.put(VoIPSTREAMConstants.Conf.VAR_DETECT_THREADS, threads);
                    // 2
                    config.put(VoIPSTREAMConstants.Conf.RCR_THREADS, threads);
                    // 2
                    config.put(VoIPSTREAMConstants.Conf.ECR_THREADS, threads);
                    // insignificant
                    config.put(VoIPSTREAMConstants.Conf.ENCR_THREADS, threads);
                    // insignificant
                    config.put(VoIPSTREAMConstants.Conf.CT24_THREADS, threads);
                    config.put(VoIPSTREAMConstants.Conf.ECR24_THREADS, threads);
                    // config.put(VoIPSTREAMConstants.Conf.GLOBAL_ACD, threads); 1
                    // 2
                    config.put(VoIPSTREAMConstants.Conf.FOFIR_THREADS, threads);
                    config.put(VoIPSTREAMConstants.Conf.URL_THREADS, threads);
                    config.put(VoIPSTREAMConstants.Conf.ACD_THREADS, threads);
                    config.put(VoIPSTREAMConstants.Conf.SCORER_THREADS, threads);
                    break;
                }
            case "LinearRoad":
            case "LinearRoad_latency":
                {
                    int threads = Math.max(1, (int) Math.floor((tthread - sthread - sithread) / 10.0));
                    // LOG.info("Average threads:" + threads);
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    config.put(LinearRoadConstants.Conf.DispatcherBoltThreads, threads);
                    // insignificant
                    config.put(LinearRoadConstants.Conf.AccidentDetectionBoltThreads, threads);
                    // insignificant
                    config.put(LinearRoadConstants.Conf.COUNT_VEHICLES_Threads, threads);
                    // insignificant
                    config.put(LinearRoadConstants.Conf.AccidentNotificationBoltThreads, threads);
                    // insignificant
                    config.put(LinearRoadConstants.Conf.toll_cv_BoltThreads, threads);
                    // insignificant
                    config.put(LinearRoadConstants.Conf.toll_las_BoltThreads, threads);
                    // insignificant
                    config.put(LinearRoadConstants.Conf.toll_pos_BoltThreads, threads);
                    config.put(LinearRoadConstants.Conf.AverageSpeedThreads, threads);
                    config.put(LinearRoadConstants.Conf.LatestAverageVelocityThreads, threads);
                    break;
                }
        }
        // Get the Brisk.topology and execute on Storm
        StormTopology stormTopology = app.getTopology(topologyName, config);
        config.put("Brisk.topology.acker.executors", 0);
        switch(mode) {
            case RUN_LOCAL:
                runTopologyLocally(stormTopology, topologyName, config, runtimeInSeconds * 3);
                break;
            case RUN_REMOTE:
                runTopologyRemotely(stormTopology, topologyName, config);
                break;
            default:
                throw new RuntimeException("Valid running modes are 'local' and 'remote'");
        }
    }
}

17 View Complete Implementation : AnchoredWordCount.java
Copyright Apache License 2.0
Author : ziyunhx
protected int run(String[] args) throws Exception {
    TopologyBuilder builder = new TopologyBuilder();
    builder.setSpout("spout", new RandomSentenceSpout(), 4);
    builder.setBolt("split", new SplitSentence(), 4).shuffleGrouping("spout");
    builder.setBolt("count", new WordCount(), 4).fieldsGrouping("split", new Fields("word"));
    Config conf = new Config();
    conf.setMaxTaskParallelism(3);
    String topologyName = "word-count";
    conf.setNumWorkers(3);
    if (args != null && args.length > 0) {
        topologyName = args[0];
    }
    return submit(topologyName, conf, builder);
}

17 View Complete Implementation : ReachTopology.java
Copyright Apache License 2.0
Author : ziyunhx
public static void main(String[] args) throws Exception {
    LinearDRPCTopologyBuilder builder = construct();
    Config conf = new Config();
    conf.setNumWorkers(6);
    String topoName = "reach-drpc";
    if (args.length > 0) {
        topoName = args[0];
    }
    StormSubmitter.submitTopologyWithProgressBar(topoName, conf, builder.createRemoteTopology());
    try (DRPCClient drpc = DRPCClient.getConfiguredClient(conf)) {
        String[] urlsToTry = new String[] { "foo.com/blog/1", "engineering.twitter.com/blog/5", "notaurl.com" };
        for (String url : urlsToTry) {
            System.out.println("Reach of " + url + ": " + drpc.execute("reach", url));
        }
    }
}

17 View Complete Implementation : TridentReach.java
Copyright Apache License 2.0
Author : ziyunhx
public static void main(String[] args) throws Exception {
    Config conf = new Config();
    StormSubmitter.submitTopology("reach", conf, buildTopology());
    try (DRPCClient drpc = DRPCClient.getConfiguredClient(conf)) {
        Thread.sleep(2000);
        System.out.println("REACH: " + drpc.execute("reach", "aaa"));
        System.out.println("REACH: " + drpc.execute("reach", "foo.com/blog/1"));
        System.out.println("REACH: " + drpc.execute("reach", "engineering.twitter.com/blog/5"));
    }
}

17 View Complete Implementation : Utils.java
Copyright Apache License 2.0
Author : alibaba
public static Config getConfig(String[] args) {
    Config ret = new Config();
    if (args == null || args.length == 0) {
        return ret;
    }
    if (StringUtils.isBlank(args[0])) {
        return ret;
    }
    Map conf = LoadConf(args[0]);
    ret.putAll(conf);
    return ret;
}

17 View Complete Implementation : TridentWindowingInmemoryStoreTopology.java
Copyright Apache License 2.0
Author : ziyunhx
public static void main(String[] args) throws Exception {
    Config conf = new Config();
    WindowsStoreFactory mapState = new InMemoryWindowsStoreFactory();
    String topoName = "wordCounter";
    if (args.length > 0) {
        topoName = args[0];
    }
    conf.setNumWorkers(3);
    StormSubmitter.submitTopologyWithProgressBar(topoName, conf, buildTopology(mapState, SlidingCountWindow.of(1000, 100)));
}

17 View Complete Implementation : KafkaStormIntegrationTest.java
Copyright Apache License 2.0
Author : apache
private SpoutConfig setUpTestKafkaSpout(Config conf) {
    ZkHosts zkHost = new ZkHosts(zookeeperLocalCluster.getConnectString());
    SpoutConfig kafkaConfig = new SpoutConfig(zkHost, topic, "/pirk_test_root", "pirk_integr_test_spout");
    kafkaConfig.scheme = new SchemeAsMultiScheme(new PirkHashScheme(conf));
    logger.info("KafkaConfig initialized...");
    return kafkaConfig;
}

17 View Complete Implementation : HBaseBolt.java
Copyright Apache License 2.0
Author : apache
@Override
public Map<String, Object> getComponentConfiguration() {
    LOG.debug("Tick tuples expected every {} second(s)", flushIntervalSecs);
    Config conf = new Config();
    conf.put(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, flushIntervalSecs);
    return conf;
}

17 View Complete Implementation : SpeedTopology.java
Copyright Apache License 2.0
Author : bbende
protected void submitTopologyLocalCluster(StormTopology topology, Config config) throws InterruptedException {
    LocalCluster cluster = new LocalCluster();
    cluster.submitTopology("test", config, topology);
    stopWaitingForInput();
}

17 View Complete Implementation : SpeedTopology.java
Copyright Apache License 2.0
Author : bbende
protected void submitTopologyRemoteCluster(String arg, StormTopology topology, Config config) throws Exception {
    StormSubmitter.submitTopology(arg, config, topology);
}

17 View Complete Implementation : FlinkRunner.java
Copyright Apache License 2.0
Author : Xtra-Computing
// import applications.Brisk.topology.special_LRF.toll.MemoryTollDataStore;
// import applications.Brisk.topology.special_LRF.tools.Helper;
public clreplaced FlinkRunner extends abstractRunner {

    private static final Logger LOG = LoggerFactory.getLogger(FlinkRunner.clreplaced);

    public static FlinkLocalCluster cluster;

    private final AppDriver driver;

    public Config config = new Config();

    public FlinkRunner() {
        driver = new AppDriver();
        // driver.addApp("Streamingreplacedysis", Streamingreplacedysis.clreplaced);//Extra
        driver.addApp("WordCount", WordCount.clreplaced);
        driver.addApp("FraudDetection", FraudDetection.clreplaced);
        driver.addApp("FraudDetection_latency", FraudDetection_latency.clreplaced);
        driver.addApp("SpikeDetection", SpikeDetection.clreplaced);
        driver.addApp("SpikeDetection_latency", SpikeDetection_latency.clreplaced);
        // driver.addApp("TrafficMonitoring", TrafficMonitoring.clreplaced);
        driver.addApp("LogProcessing_latency", LogProcessing_latency.clreplaced);
        // driver.addApp("VoIPSTREAM", VoIPSTREAM.clreplaced);
        // 
        driver.addApp("LinearRoad", LinearRoad.clreplaced);
        // 
        driver.addApp("LinearRoad_latency", LinearRoad_latency.clreplaced);
    }

    public static void main(String[] args) {
        FlinkRunner runner = new FlinkRunner();
        JCommander cmd = new JCommander(runner);
        try {
            cmd.parse(args);
        } catch (ParameterException ex) {
            System.err.println("Argument error: " + ex.getMessage());
            cmd.usage();
            System.exit(1);
        }
        try {
            runner.run();
        } catch (InterruptedException ex) {
            LOG.error("Error in running Brisk.topology locally", ex);
        }
    }

    /**
     * Run the Brisk.topology locally
     *
     * @param topology         The Brisk.topology to be executed
     * @param topologyName     The name of the Brisk.topology
     * @param conf             The Configs for the Brisk.execution
     * @param runtimeInSeconds For how much time the Brisk.topology will run
     * @throws InterruptedException
     */
    public static void runTopologyLocally(FlinkTopology topology, String topologyName, Config conf, int runtimeInSeconds) throws InterruptedException {
        LOG.info("Starting Flink on local mode to run for {} seconds", runtimeInSeconds);
        cluster = new FlinkLocalCluster();
        LOG.info("Topology {} submitted", topologyName);
        try {
            cluster.submitTopology(topologyName, conf, topology);
        } catch (Exception e) {
            e.printStackTrace();
        }
        Thread.sleep((long) runtimeInSeconds * 1000);
        cluster.shutdown();
    }

    /**
     * Run the Brisk.topology remotely
     *
     * @param topology     The Brisk.topology to be executed
     * @param topologyName The name of the Brisk.topology
     * @param conf         The Configs for the Brisk.execution
     * @throws AlreadyAliveException
     * @throws InvalidTopologyException
     */
    public static void runTopologyRemotely(FlinkTopology topology, String topologyName, Config conf) {
        // conf.registerMetricsConsumer(LoggingMetricsConsumer.clreplaced, 2);
        // conf.setMaxSpoutPending(Conf.getInt("max_pending", 5000));
        // This will simply log all Metrics received into
        // $STORM_HOME/logs/metrics.log on one or more worker nodes.
        // conf.registerMetricsConsumer(LoggingMetricsConsumer.clreplaced, 2);
        // LOG.info("max pending;" + conf.get("Brisk.topology.max.spout.pending"));
        // LOG.info("metrics.output:" + Conf.getString("metrics.output"));
        // LOG.info("NumWorkers:" + Conf.getInt("num_workers"));
        LOG.info("Run with Config:" + conf.values());
        try {
            FlinkSubmitter.submitTopology(topologyName, conf, topology);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void run() throws InterruptedException {
        // Loads the Config file set by the user or the default
        // Config
        try {
            // load default Config
            if (configStr == null) {
                String cfg = String.format(CFG_PATH, application);
                Properties p = loadProperties(cfg);
                config.put(BaseConstants.BaseConf.SPOUT_THREADS, sthread);
                config.put(BaseConstants.BaseConf.SINK_THREADS, sithread);
                config.putAll(Configuration.fromProperties(p));
                if (mode.equalsIgnoreCase(RUN_REMOTE)) {
                    final String spout_clreplaced = String.valueOf(config.get("mb.spout.clreplaced"));
                    if (spout_clreplaced.equals("applications.spout.LocalStateSpout")) {
                        LOG.info("Please use kafkaSpout in cluster mode!!!");
                        System.exit(-1);
                    }
                }
                configuration(config);
            } else {
                config.putAll(Configuration.fromStr(configStr));
                LOG.info("Loaded Config from command line argument");
            }
        } catch (IOException ex) {
            LOG.error("Unable to load Config file", ex);
            throw new RuntimeException("Unable to load Config file", ex);
        }
        // Get the descriptor for the given application
        AppDriver.AppDescriptor app = driver.getApp(application);
        if (app == null) {
            throw new RuntimeException("The given application name " + application + " is invalid");
        }
        // In case no Brisk.topology names is given, create one
        if (topologyName == null) {
            topologyName = application;
        }
        config.put(BaseConstants.BaseConf.SPOUT_THREADS, sthread);
        config.put(BaseConstants.BaseConf.SINK_THREADS, sithread);
        config.put(BaseConstants.BaseConf.PARSER_THREADS, pthread);
        // set total parallelism, equally parallelism
        int max_hz = 0;
        switch(application) {
            case "Streamingreplacedysis":
                {
                    int threads = (int) Math.ceil(tthread / 5.0);
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    config.put(streamingreplacedysisConstants.Conf.EXECUTOR_THREADS1, threads);
                    config.put(streamingreplacedysisConstants.Conf.EXECUTOR_THREADS2, threads);
                    config.put(streamingreplacedysisConstants.Conf.EXECUTOR_THREADS3, threads);
                    config.put(streamingreplacedysisConstants.Conf.EXECUTOR_THREADS4, threads);
                    break;
                }
            case "WordCount":
                {
                    // config.put(BaseConstants.BaseConf.SPOUT_THREADS, 2);//special treatment to WC>
                    int threads = (int) Math.ceil(tthread / 3.0);
                    LOG.info("Average threads:" + threads);
                    // insignificant
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    // 2
                    config.put(WordCountConstants.Conf.SPLITTER_THREADS, threads);
                    config.put(WordCountConstants.Conf.COUNTER_THREADS, threads);
                    max_hz = WordCountConstants.max_hz;
                    break;
                }
            case "FraudDetection":
                {
                    // config.put(BaseConstants.BaseConf.SPOUT_THREADS, 1);//special treatment to SD>
                    int threads = Math.max(1, (int) Math.floor((tthread - sthread - sithread) / 2.0));
                    // insignificant
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    config.put(FraudDetectionConstants.Conf.PREDICTOR_THREADS, threads);
                    max_hz = FraudDetectionConstants.max_hz;
                    break;
                }
            case "SpikeDetection":
                {
                    // config.put(BaseConstants.BaseConf.SPOUT_THREADS, 1);//special treatment to SD>
                    int threads = Math.max(1, (int) Math.floor((tthread - sthread - sithread) / 3.0));
                    LOG.info("Average threads:" + threads);
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    // insignificant
                    config.put(SpikeDetectionConstants.Conf.MOVING_AVERAGE_THREADS, threads);
                    // insignificant
                    config.put(SpikeDetectionConstants.Conf.SPIKE_DETECTOR_THREADS, threads);
                    max_hz = SpikeDetectionConstants.max_hz;
                    break;
                }
            // case "TrafficMonitoring": {
            // int threads = tthread / 1;
            // //                        config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
            // config.put(TrafficMonitoringConstants.Conf.MAP_MATCHER_THREADS, threads);//*5
            // //                        config.put(TrafficMonitoringConstants.Conf.SPEED_CALCULATOR_THREADS, threads);
            // max_hz = TrafficMonitoringConstants.max_hz;
            // break;
            // }
            case "LogProcessing":
                {
                    // special treatment to LG>
                    config.put(BaseConstants.BaseConf.SPOUT_THREADS, 1);
                    int threads = (int) Math.ceil(tthread / 5.0);
                    LOG.info("Average threads:" + threads);
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    // 2
                    config.put(LogProcessingConstants.Conf.GEO_FINDER_THREADS, threads);
                    // insignificant
                    config.put(LogProcessingConstants.Conf.GEO_STATS_THREADS, threads);
                    // insignificant
                    config.put(LogProcessingConstants.Conf.STATUS_COUNTER_THREADS, threads);
                    // insignificant
                    config.put(LogProcessingConstants.Conf.VOLUME_COUNTER_THREADS, threads);
                    break;
                }
            case "VoIPSTREAM":
                {
                    int threads = (int) Math.ceil(tthread / 11.0);
                    LOG.info("Average threads:" + threads);
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    config.put(VoIPSTREAMConstants.Conf.VAR_DETECT_THREADS, threads);
                    // 2
                    config.put(VoIPSTREAMConstants.Conf.RCR_THREADS, threads);
                    // 2
                    config.put(VoIPSTREAMConstants.Conf.ECR_THREADS, threads);
                    // insignificant
                    config.put(VoIPSTREAMConstants.Conf.ENCR_THREADS, threads);
                    // insignificant
                    config.put(VoIPSTREAMConstants.Conf.CT24_THREADS, threads);
                    config.put(VoIPSTREAMConstants.Conf.ECR24_THREADS, threads);
                    // config.put(VoIPSTREAMConstants.Conf.GLOBAL_ACD, threads); 1
                    // 2
                    config.put(VoIPSTREAMConstants.Conf.FOFIR_THREADS, threads);
                    config.put(VoIPSTREAMConstants.Conf.URL_THREADS, threads);
                    config.put(VoIPSTREAMConstants.Conf.ACD_THREADS, threads);
                    config.put(VoIPSTREAMConstants.Conf.SCORER_THREADS, threads);
                    break;
                }
            case "LinearRoad":
                {
                    int threads = Math.max(1, (int) Math.floor((tthread - sthread - sithread) / 10.0));
                    // LOG.info("Average threads:" + threads);
                    config.put(BaseConstants.BaseConf.PARSER_THREADS, threads);
                    config.put(LinearRoadConstants.Conf.DispatcherBoltThreads, threads);
                    // insignificant
                    config.put(LinearRoadConstants.Conf.AccidentDetectionBoltThreads, threads);
                    // insignificant
                    config.put(LinearRoadConstants.Conf.COUNT_VEHICLES_Threads, threads);
                    // insignificant
                    config.put(LinearRoadConstants.Conf.AccidentNotificationBoltThreads, threads);
                    // insignificant
                    config.put(LinearRoadConstants.Conf.toll_cv_BoltThreads, threads);
                    // insignificant
                    config.put(LinearRoadConstants.Conf.toll_las_BoltThreads, threads);
                    // insignificant
                    config.put(LinearRoadConstants.Conf.toll_pos_BoltThreads, threads);
                    config.put(LinearRoadConstants.Conf.AverageSpeedThreads, threads);
                    config.put(LinearRoadConstants.Conf.LatestAverageVelocityThreads, threads);
                    break;
                }
        }
        // Get the Brisk.topology and execute on Storm
        FlinkTopology flinkTopology = app.getTopology(topologyName, config);
        switch(mode) {
            case RUN_LOCAL:
                runTopologyLocally(flinkTopology, topologyName, config, runtimeInSeconds * 2);
                break;
            case RUN_REMOTE:
                runTopologyRemotely(flinkTopology, topologyName, config);
                break;
            default:
                throw new RuntimeException("Valid running modes are 'local' and 'remote'");
        }
    }
}

17 View Complete Implementation : BlobStoreAPIWordCountTopology.java
Copyright Apache License 2.0
Author : ziyunhx
public static void prepare() {
    Config conf = new Config();
    conf.putAll(Utils.readStormConfig());
    store = Utils.getClientBlobStore(conf);
}

17 View Complete Implementation : SpeedTopology.java
Copyright Apache License 2.0
Author : bbende
protected Config getConfig() {
    Config config = new Config();
    config.setDebug(true);
    config.setMessageTimeoutSecs((WINDOW_SIZE_MS / 1000) * 2);
    return config;
}

17 View Complete Implementation : SigarLoggingMetricsConsumer.java
Copyright Apache License 2.0
Author : bullet-db
/**
 * Registers the Sigar CPUMetric and the LoggingMetricsConsumer with a parallelism of 1.
 *
 * @param stormConfig The Storm {@link Config} to add to.
 * @param bulletStormConfig The Bullet {@link BulletStormConfig} to get information from.
 */
public static void register(Config stormConfig, BulletStormConfig bulletStormConfig) {
    stormConfig.registerMetricsConsumer(LoggingMetricsConsumer.clreplaced);
    Map<String, String> metrics = (Map<String, String>) stormConfig.getOrDefault(Config.TOPOLOGY_WORKER_METRICS, new HashMap<>());
    metrics.putAll(METRICS);
    stormConfig.put(Config.TOPOLOGY_WORKER_METRICS, metrics);
}

17 View Complete Implementation : AbstractStormSuite.java
Copyright Apache License 2.0
Author : elastic
private static void copyPropertiesIntoCfg(Config cfg) {
    Properties props = TestSettings.TESTING_PROPS;
    for (String property : props.stringPropertyNames()) {
        cfg.put(property, props.get(property));
    }
}

17 View Complete Implementation : RulesTopologyTest.java
Copyright Apache License 2.0
Author : hortonworks
protected void submitTopology() throws AlreadyAliveException, InvalidTopologyException {
    final Config config = getConfig();
    final String topologyName = "RulesTopologyTest";
    ILocalCluster localCluster = new LocalCluster();
    localCluster.submitTopology(topologyName, config, createTopology());
}

17 View Complete Implementation : ThresholdingEngine.java
Copyright Apache License 2.0
Author : openstack
protected void run() throws Exception {
    Config config = Injector.getInstance(Config.clreplaced);
    StormTopology topology = Injector.getInstance(StormTopology.clreplaced);
    config.registerSerialization(monasca.thresh.domain.model.SubAlarm.clreplaced);
    config.registerSerialization(monasca.thresh.domain.model.SubExpression.clreplaced);
    if (local) {
        logger.info("submitting topology {} to local storm cluster", topologyName);
        new LocalCluster().submitTopology(topologyName, config, topology);
    } else {
        logger.info("submitting topology {} to non-local storm cluster", topologyName);
        StormSubmitter.submitTopology(topologyName, config, topology);
    }
}

17 View Complete Implementation : StormLocalCluster.java
Copyright Apache License 2.0
Author : sakserv
public clreplaced StormLocalCluster implements MiniCluster {

    // Logger
    private static final Logger LOG = LoggerFactory.getLogger(StormLocalCluster.clreplaced);

    private String zookeeperHost;

    private Long zookeeperPort;

    private Boolean enableDebug;

    private Integer numWorkers;

    private Config stormConf;

    private ILocalCluster localCluster;

    private StormLocalCluster(Builder builder) {
        this.zookeeperHost = builder.zookeeperHost;
        this.zookeeperPort = builder.zookeeperPort;
        this.enableDebug = builder.enableDebug;
        this.numWorkers = builder.numWorkers;
        this.stormConf = builder.stormConf;
    }

    public String getZookeeperHost() {
        return zookeeperHost;
    }

    public Long getZookeeperPort() {
        return zookeeperPort;
    }

    public Boolean getEnableDebug() {
        return enableDebug;
    }

    public Integer getNumWorkers() {
        return numWorkers;
    }

    public Config getStormConf() {
        return stormConf;
    }

    public static clreplaced Builder {

        private String zookeeperHost;

        private Long zookeeperPort;

        private Boolean enableDebug;

        private Integer numWorkers;

        private Config stormConf;

        public Builder setZookeeperHost(String zookeeperHost) {
            this.zookeeperHost = zookeeperHost;
            return this;
        }

        public Builder setZookeeperPort(Long zookeeperPort) {
            this.zookeeperPort = zookeeperPort;
            return this;
        }

        public Builder setEnableDebug(Boolean enableDebug) {
            this.enableDebug = enableDebug;
            return this;
        }

        public Builder setNumWorkers(Integer numWorkers) {
            this.numWorkers = numWorkers;
            return this;
        }

        public Builder setStormConfig(Config stormConf) {
            this.stormConf = stormConf;
            return this;
        }

        public StormLocalCluster build() {
            StormLocalCluster stormLocalCluster = new StormLocalCluster(this);
            validateObject(stormLocalCluster);
            return stormLocalCluster;
        }

        public void validateObject(StormLocalCluster stormLocalCluster) {
            if (stormLocalCluster.getZookeeperHost() == null) {
                throw new IllegalArgumentException("ERROR: Missing required config: Zookeeper Host");
            }
            if (stormLocalCluster.getZookeeperPort() == null) {
                throw new IllegalArgumentException("ERROR: Missing required config: Zookeeper Port");
            }
            if (stormLocalCluster.getEnableDebug() == null) {
                throw new IllegalArgumentException("ERROR: Missing required config: Enable Debug");
            }
            if (stormLocalCluster.getNumWorkers() == null) {
                throw new IllegalArgumentException("ERROR: Missing required config: Num Workers");
            }
            if (stormLocalCluster.getStormConf() == null) {
                throw new IllegalArgumentException("ERROR: Missing required config: Storm Config");
            }
        }
    }

    @Override
    public void start() throws Exception {
        LOG.info("STORM: Starting StormLocalCluster");
        configure();
        localCluster = Testing.getLocalCluster(stormConf);
    }

    @Override
    public void stop() throws Exception {
        stop(true);
    }

    @Override
    public void stop(boolean cleanUp) throws Exception {
        LOG.info("STORM: Stopping StormLocalCluster");
        localCluster.shutdown();
        if (cleanUp) {
            cleanUp();
        }
    }

    @Override
    public void configure() throws Exception {
        stormConf.setDebug(enableDebug);
        stormConf.setNumWorkers(numWorkers);
        stormConf.put("nimbus-daemon", true);
        List<String> stormNimbusSeeds = new ArrayList<>();
        stormNimbusSeeds.add("localhost");
        stormConf.put(Config.NIMBUS_SEEDS, stormNimbusSeeds);
        stormConf.put(Config.NIMBUS_THRIFT_PORT, 6627);
        stormConf.put(Config.STORM_THRIFT_TRANSPORT_PLUGIN, "org.apache.storm.security.auth.SimpleTransportPlugin");
        stormConf.put(Config.STORM_NIMBUS_RETRY_INTERVAL_CEILING, 60000);
        stormConf.put(Config.STORM_NIMBUS_RETRY_TIMES, 5);
        stormConf.put(Config.STORM_NIMBUS_RETRY_INTERVAL, 2000);
        stormConf.put(Config.NIMBUS_THRIFT_MAX_BUFFER_SIZE, 1048576);
        stormConf.put(Config.STORM_ZOOKEEPER_SERVERS, Arrays.asList(getZookeeperHost()));
        stormConf.put(Config.STORM_ZOOKEEPER_PORT, getZookeeperPort());
    }

    @Override
    public void cleanUp() throws Exception {
        FileUtils.deleteFolder("logs");
    }

    public void submitTopology(String topologyName, Config conf, StormTopology topology) throws AlreadyAliveException, InvalidTopologyException {
        localCluster.submitTopology(topologyName, conf, topology);
    }

    public void stop(String topologyName) throws Exception {
        try {
            localCluster.killTopology(topologyName);
        } catch (NotAliveException e) {
            LOG.debug("Topology not running: " + topologyName);
        }
        stop();
    }
}

17 View Complete Implementation : AbstractStormTest.java
Copyright Apache License 2.0
Author : telstra
protected static Config stormConfig() {
    Config config = new Config();
    config.setDebug(false);
    config.setMaxTaskParallelism(1);
    config.setNumWorkers(1);
    return config;
}

17 View Complete Implementation : FlinkRunner.java
Copyright Apache License 2.0
Author : Xtra-Computing
/**
 * Run the Brisk.topology locally
 *
 * @param topology         The Brisk.topology to be executed
 * @param topologyName     The name of the Brisk.topology
 * @param conf             The Configs for the Brisk.execution
 * @param runtimeInSeconds For how much time the Brisk.topology will run
 * @throws InterruptedException
 */
public static void runTopologyLocally(FlinkTopology topology, String topologyName, Config conf, int runtimeInSeconds) throws InterruptedException {
    LOG.info("Starting Flink on local mode to run for {} seconds", runtimeInSeconds);
    cluster = new FlinkLocalCluster();
    LOG.info("Topology {} submitted", topologyName);
    try {
        cluster.submitTopology(topologyName, conf, topology);
    } catch (Exception e) {
        e.printStackTrace();
    }
    Thread.sleep((long) runtimeInSeconds * 1000);
    cluster.shutdown();
}

16 View Complete Implementation : SentenceWordCountTopology.java
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws Exception {
    String name = "fast-word-count-topology";
    if (args != null && args.length > 0) {
        name = args[0];
    }
    TopologyBuilder builder = new TopologyBuilder();
    builder.setSpout("spout", new FastRandomSentenceSpout(), 1);
    builder.setBolt("split", new SplitSentence(), 2).shuffleGrouping("spout");
    builder.setBolt("count", new WordCount(), 2).fieldsGrouping("split", new Fields("word"));
    Config conf = new Config();
    StormSubmitter.submitTopology(name, conf, builder.createTopology());
}

16 View Complete Implementation : PirkHashScheme.java
Copyright Apache License 2.0
Author : apache
/**
 * Scheme used by spout to retrieve and hash selector from JSON data on Kafka.
 */
public clreplaced PirkHashScheme extends StringScheme implements Scheme {

    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(PirkHashScheme.clreplaced);

    private QueryInfo queryInfo;

    transient private JSONParser parser;

    private boolean initialized = false;

    private QuerySchema qSchema;

    private Config conf;

    public PirkHashScheme(Config conf) {
        this.conf = conf;
    }

    public List<Object> deserialize(ByteBuffer bytes) {
        if (!initialized) {
            parser = new JSONParser();
            queryInfo = new QueryInfo((Map) conf.get(StormConstants.QUERY_INFO_KEY));
            StormUtils.initializeSchemas(conf, "hashScheme");
            if ((boolean) conf.get(StormConstants.ALLOW_ADHOC_QSCHEMAS_KEY)) {
                qSchema = queryInfo.getQuerySchema();
            }
            if (qSchema == null) {
                qSchema = QuerySchemaRegistry.get(queryInfo.getQueryType());
            }
            initialized = true;
        }
        String str = deserializeString(bytes);
        JSONObject json;
        try {
            json = (JSONObject) parser.parse(str);
        } catch (ParseException e) {
            json = null;
            logger.warn("ParseException parsing " + str, e);
        }
        String selector = QueryUtils.getSelectorByQueryTypeJSON(qSchema, json);
        int hash = KeyedHash.hash(queryInfo.getHashKey(), queryInfo.getHashBitSize(), selector);
        return new Values(hash, json);
    }

    public Fields getOutputFields() {
        return new Fields(StormConstants.HASH_FIELD, StormConstants.JSON_DATA_FIELD);
    }
}

16 View Complete Implementation : KafkaStormIntegrationTest.java
Copyright Apache License 2.0
Author : apache
private void runTopology(File responderFile) throws Exception {
    MkClusterParam mkClusterParam = new MkClusterParam();
    // The test sometimes fails because of timing issues when more than 1 supervisor set.
    mkClusterParam.setSupervisors(1);
    // Maybe using "withSimulatedTimeLocalCluster" would be better to avoid worrying about timing.
    Config conf = PirkTopology.createStormConf();
    conf.put(StormConstants.OUTPUT_FILE_KEY, responderFile.getAbsolutePath());
    conf.put(StormConstants.N_SQUARED_KEY, nSquared.toString());
    conf.put(StormConstants.QUERY_INFO_KEY, queryInfo.toMap());
    // conf.setDebug(true);
    mkClusterParam.setDaemonConf(conf);
    TestJob testJob = createPirkTestJob(conf);
    Testing.withLocalCluster(mkClusterParam, testJob);
// Testing.withSimulatedTimeLocalCluster(mkClusterParam, testJob);
}

16 View Complete Implementation : WindowedQueryBolt_TestTopology.java
Copyright Apache License 2.0
Author : hortonworks
// main
private static Nimbus.Client runOnStormCluster(Config conf, StormTopology topology) throws AlreadyAliveException, InvalidTopologyException, AuthorizationException {
    Map<String, Object> clusterConf = Utils.readStormConfig();
    StormSubmitter.submitTopologyWithProgressBar(TOPO_NAME, conf, topology);
    return NimbusClient.getConfiguredClient(clusterConf).getClient();
}

16 View Complete Implementation : StormLocalClusterIntegrationTest.java
Copyright Apache License 2.0
Author : sakserv
@Test
public void testStormNimbusClient() throws Exception {
    Config conf = stormLocalCluster.getStormConf();
    NimbusClient nimbusClient = NimbusClient.getConfiguredClient(conf);
    replacedertTrue(nimbusClient.getClient().getNimbusConf().length() > 0);
}

16 View Complete Implementation : AbstractTopology.java
Copyright Apache License 2.0
Author : telstra
private void setupRemote() throws TException, NameCollisionException {
    Config config = makeStormConfig();
    config.setDebug(false);
    logger.info("Submit Topology: {}", topologyName);
    StormSubmitter.submitTopology(topologyName, config, createTopology());
}

16 View Complete Implementation : StableAbstractStormTest.java
Copyright Apache License 2.0
Author : telstra
protected static void startCompleteTopology() throws Exception {
    log.info("Starting CompleteTopology ...");
    clusterParam = new MkClusterParam();
    clusterParam.setSupervisors(1);
    Config daemonConfig = new Config();
    daemonConfig.put(Config.STORM_LOCAL_MODE_ZMQ, false);
    clusterParam.setDaemonConf(daemonConfig);
    makeConfigFile();
    Config conf = new Config();
    conf.setNumWorkers(1);
    completeTopologyParam = new CompleteTopologyParam();
    completeTopologyParam.setStormConf(conf);
}

16 View Complete Implementation : BasicDRPCTopology.java
Copyright Apache License 2.0
Author : ziyunhx
public static void main(String[] args) throws Exception {
    Config conf = new Config();
    String topoName = "DRPCExample";
    String function = "exclamation";
    if (args != null) {
        if (args.length > 0) {
            topoName = args[0];
        }
        if (args.length > 1) {
            function = args[1];
        }
    }
    LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder(function);
    builder.addBolt(new ExclaimBolt(), 3);
    conf.setNumWorkers(3);
    StormSubmitter.submitTopologyWithProgressBar(topoName, conf, builder.createRemoteTopology());
    if (args != null && args.length > 2) {
        try (DRPCClient drpc = DRPCClient.getConfiguredClient(conf)) {
            for (int i = 2; i < args.length; i++) {
                String word = args[i];
                System.out.println("Result for \"" + word + "\": " + drpc.execute(function, word));
            }
        }
    }
}

16 View Complete Implementation : TridentHBaseWindowingStoreTopology.java
Copyright Apache License 2.0
Author : ziyunhx
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"));
    String topoName = "wordCounterWithWindowing";
    if (args.length > 0) {
        topoName = args[0];
    }
    conf.setNumWorkers(3);
    StormSubmitter.submitTopologyWithProgressBar(topoName, conf, buildTopology(windowStoreFactory));
}

16 View Complete Implementation : TridentMinMaxOfDevicesTopology.java
Copyright Apache License 2.0
Author : ziyunhx
public static void main(String[] args) throws Exception {
    StormTopology topology = buildDevicesTopology();
    Config conf = new Config();
    conf.setMaxSpoutPending(20);
    conf.setNumWorkers(3);
    StormSubmitter.submitTopologyWithProgressBar("devices-topology", conf, topology);
}

16 View Complete Implementation : TridentMinMaxOfVehiclesTopology.java
Copyright Apache License 2.0
Author : ziyunhx
public static void main(String[] args) throws Exception {
    StormTopology topology = buildVehiclesTopology();
    Config conf = new Config();
    conf.setMaxSpoutPending(20);
    conf.setNumWorkers(3);
    StormSubmitter.submitTopologyWithProgressBar("vehicles-topology", conf, topology);
}