com.github.charithe.kafka.KafkaJunitRule Java Examples
The following examples show how to use
com.github.charithe.kafka.KafkaJunitRule.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KafkaSenderBenchmarks.java From zipkin-reporter-java with Apache License 2.0 | 6 votes |
@Override protected Sender createSender() throws Exception { broker.start(); kafka = new KafkaJunitRule(broker).waitForStartup(); consumer = kafka.helper().createByteConsumer(); consumer.subscribe(Collections.singletonList("zipkin")); new Thread(() -> { while (true) { Iterator<ConsumerRecord<byte[], byte[]>> messages = consumer.poll(1000L).iterator(); while (messages.hasNext()) { messages.next(); } } }).start(); return KafkaSender.create(broker.getBrokerList().get()); }
Example #2
Source File: TestHelper.java From adaptive-alerting with Apache License 2.0 | 4 votes |
public static String bootstrapServers(KafkaJunitRule kafka) { return kafka.helper() .consumerConfig() .getProperty(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG); }