use of backtype.storm.spout.SpoutOutputCollector in project storm by nathanmarz.
the class RichSpoutBatchTriggerer method open.
@Override
public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {
_delegate.open(conf, context, new SpoutOutputCollector(new StreamOverrideCollector(collector)));
_outputTasks = new ArrayList<Integer>();
for (String component : Utils.get(context.getThisTargets(), _coordStream, new HashMap<String, Grouping>()).keySet()) {
_outputTasks.addAll(context.getComponentTasks(component));
}
_rand = new Random(Utils.secureRandomLong());
}
use of backtype.storm.spout.SpoutOutputCollector in project storm by nathanmarz.
the class SpoutTracker method open.
public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {
_tracker = new SpoutTrackOutputCollector(collector);
_delegate.open(conf, context, new SpoutOutputCollector(_tracker));
}
use of backtype.storm.spout.SpoutOutputCollector in project jstorm by alibaba.
the class RichSpoutBatchTriggerer method open.
@Override
public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {
_delegate.open(conf, context, new SpoutOutputCollector(new StreamOverrideCollector(collector)));
_outputTasks = new ArrayList<>();
for (String component : Utils.get(context.getThisTargets(), _coordStream, new HashMap<String, Grouping>()).keySet()) {
_outputTasks.addAll(context.getComponentTasks(component));
}
_rand = new Random(Utils.secureRandomLong());
}
use of backtype.storm.spout.SpoutOutputCollector in project jstorm by alibaba.
the class TransactionSpout method open.
@Override
public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {
this.conf = conf;
this.topologyContext = context;
this.topologyId = topologyContext.getTopologyId();
this.taskId = topologyContext.getThisTaskId();
this.topologyMasterId = topologyContext.getTopologyMasterId();
this.componentId = topologyContext.getThisComponentId();
this.groupId = TransactionCommon.groupIndex(context.getRawTopology(), componentId);
this.downstreamTasks = TransactionCommon.getDownstreamTasks(componentId, topologyContext);
this.outputCollector = new TransactionSpoutOutputCollector(collector, this);
this.spoutStatus = State.INIT;
this.committingBatches = new TreeSet<Long>();
this.isMaxPending = false;
this.MAX_PENDING_BATCH_NUM = JStormUtils.parseInt(conf.get("transaction.max.pending.batch"), 2);
int taskLaunchTimeout = JStormUtils.parseInt(conf.get(Config.NIMBUS_TASK_LAUNCH_SECS));
int spoutInitRetryDelaySec = JStormUtils.parseInt(conf.get("transaction.spout.init.retry.secs"), taskLaunchTimeout);
this.initRetryCheck = new IntervalCheck();
initRetryCheck.setInterval(spoutInitRetryDelaySec);
this.lock = new ReentrantLock(true);
spoutExecutor.open(conf, context, new SpoutOutputCollector(outputCollector));
}
use of backtype.storm.spout.SpoutOutputCollector in project pulsar by yahoo.
the class PulsarSpoutTest method testSharedConsumer.
@Test
public void testSharedConsumer() throws Exception {
PersistentTopicStats topicStats = admin.persistentTopics().getStats(topic);
Assert.assertEquals(topicStats.subscriptions.get(subscriptionName).consumers.size(), 1);
PulsarSpout otherSpout = new PulsarSpout(pulsarSpoutConf, new ClientConfiguration(), consumerConf);
MockSpoutOutputCollector otherMockCollector = new MockSpoutOutputCollector();
SpoutOutputCollector collector = new SpoutOutputCollector(otherMockCollector);
TopologyContext context = mock(TopologyContext.class);
when(context.getThisComponentId()).thenReturn("test-spout-" + methodName);
when(context.getThisTaskId()).thenReturn(1);
otherSpout.open(Maps.newHashMap(), context, collector);
topicStats = admin.persistentTopics().getStats(topic);
Assert.assertEquals(topicStats.subscriptions.get(subscriptionName).consumers.size(), 1);
otherSpout.close();
topicStats = admin.persistentTopics().getStats(topic);
Assert.assertEquals(topicStats.subscriptions.get(subscriptionName).consumers.size(), 1);
}
Aggregations