Search in sources :

Example 1 with DefaultMessageDistributor

use of org.apache.metron.profiler.DefaultMessageDistributor in project metron by apache.

the class ProfileBuilderBolt method prepare.

@Override
public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) {
    super.prepare(stormConf, context, collector);
    if (periodDurationMillis <= 0) {
        throw new IllegalArgumentException("expect 'profiler.period.duration' >= 0");
    }
    if (profileTimeToLiveMillis <= 0) {
        throw new IllegalArgumentException("expect 'profiler.ttl' >= 0");
    }
    if (profileTimeToLiveMillis < periodDurationMillis) {
        throw new IllegalArgumentException("expect 'profiler.ttl' >= 'profiler.period.duration'");
    }
    if (maxNumberOfRoutes <= 0) {
        throw new IllegalArgumentException("expect 'profiler.max.routes.per.bolt' > 0");
    }
    if (windowDurationMillis <= 0) {
        throw new IllegalArgumentException("expect 'profiler.window.duration' > 0");
    }
    if (windowDurationMillis > periodDurationMillis) {
        throw new IllegalArgumentException("expect 'profiler.period.duration' >= 'profiler.window.duration'");
    }
    if (periodDurationMillis % windowDurationMillis != 0) {
        throw new IllegalArgumentException("expect 'profiler.period.duration' % 'profiler.window.duration' == 0");
    }
    this.collector = collector;
    this.parser = new JSONParser();
    this.messageDistributor = new DefaultMessageDistributor(periodDurationMillis, profileTimeToLiveMillis, maxNumberOfRoutes);
    this.configurations = new ProfilerConfigurations();
    this.flushSignal = new FixedFrequencyFlushSignal(periodDurationMillis);
    setupZookeeper();
}
Also used : JSONParser(org.json.simple.parser.JSONParser) DefaultMessageDistributor(org.apache.metron.profiler.DefaultMessageDistributor) ProfilerConfigurations(org.apache.metron.common.configuration.profiler.ProfilerConfigurations)

Aggregations

ProfilerConfigurations (org.apache.metron.common.configuration.profiler.ProfilerConfigurations)1 DefaultMessageDistributor (org.apache.metron.profiler.DefaultMessageDistributor)1 JSONParser (org.json.simple.parser.JSONParser)1