public static void addMetricComponents(Map<String, Object> conf, StormTopology topology) { Map<String, Bolt> metricsConsumerBolts = metricsConsumerBoltSpecs(conf, topology); for (Map.Entry<String, Bolt> entry : metricsConsumerBolts.entrySet()) { topology.put_to_bolts(entry.getKey(), entry.getValue()); } }
@SuppressWarnings("unused") public static void addSystemComponents(Map<String, Object> conf, StormTopology topology) { Map<String, StreamInfo> outputStreams = new HashMap<>(); outputStreams.put(Constants.SYSTEM_TICK_STREAM_ID, Thrift.outputFields(Arrays.asList("rate_secs"))); outputStreams.put(Constants.SYSTEM_FLUSH_STREAM_ID, Thrift.outputFields(Arrays.asList())); outputStreams.put(Constants.METRICS_TICK_STREAM_ID, Thrift.outputFields(Arrays.asList("interval"))); outputStreams.put(Constants.CREDENTIALS_CHANGED_STREAM_ID, Thrift.outputFields(Arrays.asList("creds"))); Map<String, Object> boltConf = new HashMap<>(); boltConf.put(Config.TOPOLOGY_TASKS, 0); Bolt systemBoltSpec = Thrift.prepareSerializedBoltDetails(null, new SystemBolt(), outputStreams, 0, boltConf); topology.put_to_bolts(Constants.SYSTEM_COMPONENT_ID, systemBoltSpec); }
public static void addEventLogger(Map<String, Object> conf, StormTopology topology) { Integer numExecutors = ObjectReader.getInt(conf.get(Config.TOPOLOGY_EVENTLOGGER_EXECUTORS), ObjectReader.getInt(conf.get(Config.TOPOLOGY_WORKERS))); if (numExecutors == null || numExecutors == 0) { return; } HashMap<String, Object> componentConf = new HashMap<>(); componentConf.put(Config.TOPOLOGY_TASKS, numExecutors); componentConf.put(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, ObjectReader.getInt(conf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS))); Bolt eventLoggerBolt = Thrift.prepareSerializedBoltDetails( eventLoggerInputs(topology), new EventLoggerBolt(), null, numExecutors, componentConf); for (Object component : allComponents(topology).values()) { ComponentCommon common = getComponentCommon(component); common.put_to_streams(EVENTLOGGER_STREAM_ID, Thrift.outputFields(eventLoggerBoltFields())); } topology.put_to_bolts(EVENTLOGGER_COMPONENT_ID, eventLoggerBolt); }
topology.put_to_bolts(Utils.uuid(), new Bolt(Thrift.serializeComponentObject(capturer), Thrift.prepareComponentCommon(captureBoltInputs, new HashMap<>(), null))); return new CapturedTopology<>(topology, capturer);
topology.put_to_bolts(Acker.ACKER_COMPONENT_ID, acker);