use of backtype.storm.spout.SpoutOutputCollector in project pulsar by yahoo.
the class PulsarSpoutTest method setup.
@Override
protected void setup() throws Exception {
super.internalSetup();
super.producerBaseSetup();
pulsarSpoutConf = new PulsarSpoutConfiguration();
pulsarSpoutConf.setServiceUrl(serviceUrl);
pulsarSpoutConf.setTopic(topic);
pulsarSpoutConf.setSubscriptionName(subscriptionName);
pulsarSpoutConf.setMessageToValuesMapper(messageToValuesMapper);
pulsarSpoutConf.setFailedRetriesTimeout(1, TimeUnit.SECONDS);
pulsarSpoutConf.setMaxFailedRetries(2);
pulsarSpoutConf.setSharedConsumerEnabled(true);
pulsarSpoutConf.setMetricsTimeIntervalInSecs(60);
consumerConf = new ConsumerConfiguration();
consumerConf.setSubscriptionType(SubscriptionType.Shared);
spout = new PulsarSpout(pulsarSpoutConf, new ClientConfiguration(), consumerConf);
mockCollector = new MockSpoutOutputCollector();
SpoutOutputCollector collector = new SpoutOutputCollector(mockCollector);
TopologyContext context = mock(TopologyContext.class);
when(context.getThisComponentId()).thenReturn("test-spout-" + methodName);
when(context.getThisTaskId()).thenReturn(0);
spout.open(Maps.newHashMap(), context, collector);
producer = pulsarClient.createProducer(topic);
}
use of backtype.storm.spout.SpoutOutputCollector in project kafka-spout by HolmesNL.
the class KafkaSpoutConstructorTest method testOpenWithOverloadedConstructorAndStormConfig.
/**
* If we use the overloaded constructor, with the topic name, it does not matter what is in the storm config.
*/
@Test
public void testOpenWithOverloadedConstructorAndStormConfig() {
KafkaSpout spout = spy(new KafkaSpout("OVERLOAD"));
TopologyContext topology = mock(TopologyContext.class);
SpoutOutputCollector collector = mock(SpoutOutputCollector.class);
Map<String, Object> config = new HashMap<String, Object>();
config.put(ConfigUtils.CONFIG_TOPIC, "topic");
doNothing().when(spout).createConsumer(config);
spout.open(config, topology, collector);
assertEquals("Wrong Topic Name", spout._topic, "OVERLOAD");
}
use of backtype.storm.spout.SpoutOutputCollector in project jstorm by alibaba.
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 kafka-spout by HolmesNL.
the class KafkaSpoutConstructorTest method testOpenWithDefaultTopicName.
/**
* Using the default constructor, a topic name must be in the storm config.
*/
@Test
public void testOpenWithDefaultTopicName() {
KafkaSpout spout = spy(new KafkaSpout());
TopologyContext topology = mock(TopologyContext.class);
SpoutOutputCollector collector = mock(SpoutOutputCollector.class);
Map<String, Object> config = new HashMap<String, Object>();
doNothing().when(spout).createConsumer(config);
spout.open(config, topology, collector);
assertEquals("Wrong Topic Name", spout._topic, ConfigUtils.DEFAULT_TOPIC);
}
use of backtype.storm.spout.SpoutOutputCollector in project kafka-spout by HolmesNL.
the class KafkaSpoutConstructorTest method testOpenWithOverloadedConstructor.
/**
* If we use the overloaded constructor, do not even look at the storm config for the topic name.
*/
@Test
public void testOpenWithOverloadedConstructor() {
KafkaSpout spout = spy(new KafkaSpout("OVERLOAD"));
TopologyContext topology = mock(TopologyContext.class);
SpoutOutputCollector collector = mock(SpoutOutputCollector.class);
Map<String, Object> config = new HashMap<String, Object>();
doNothing().when(spout).createConsumer(config);
spout.open(config, topology, collector);
assertEquals("Wrong Topic Name", spout._topic, "OVERLOAD");
}
Aggregations