use of io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class KafkaSourceTest method myKafkaSourceConfig.
private KafkaMapBasedConfig myKafkaSourceConfig(String topic, String group) {
KafkaMapBasedConfig config = kafkaConfig("mp.messaging.incoming.data");
config.put("group.id", group);
config.put("value.deserializer", IntegerDeserializer.class.getName());
config.put("enable.auto.commit", "false");
config.put("auto.offset.reset", "earliest");
config.put("topic", topic);
return config;
}
use of io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class KafkaSourceTest method myKafkaSourceConfigWithoutAck.
private KafkaMapBasedConfig myKafkaSourceConfigWithoutAck(String suffix, boolean shorterTimeouts) {
KafkaMapBasedConfig config = kafkaConfig("mp.messaging.incoming.data");
config.put("group.id", "my-group-starting-on-fifth-" + suffix);
config.put("value.deserializer", IntegerDeserializer.class.getName());
config.put("enable.auto.commit", "false");
config.put("auto.offset.reset", "earliest");
config.put("topic", "data-starting-on-fifth-" + suffix);
if (shorterTimeouts) {
config.put("max.poll.interval.ms", "2000");
}
return config;
}
use of io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class KafkaSourceTest method myKafkaSourceConfig.
// @SuppressWarnings({ "rawtypes" })
// @Test
// public void testRecoveryAfterMissedHeartbeat() throws InterruptedException {
// MapBasedConfig config = newCommonConfigForSource()
// .with("bootstrap.servers", KafkaBrokerExtension.usage.getBootstrapServers())
// .with("value.deserializer", IntegerDeserializer.class.getName())
// .with(ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, 6000)
// .with(ConsumerConfig.HEARTBEAT_INTERVAL_MS_CONFIG, 100)
// .with("retry", true)
// .with("retry-attempts", 100)
// .with("retry-max-wait", 30);
//
// usage.setBootstrapServers(KafkaBrokerExtension.usage.getBootstrapServers());
//
// KafkaConnectorIncomingConfiguration ic = new KafkaConnectorIncomingConfiguration(config);
// source = new KafkaSource<>(vertx, UUID.randomUUID().toString(), ic,
// UnsatisfiedInstance.instance(), CountKafkaCdiEvents.noCdiEvents,
// UnsatisfiedInstance.instance(), -1);
// List<KafkaRecord> messages1 = new ArrayList<>();
// source.getStream().subscribe().with(messages1::add);
//
// AtomicInteger counter = new AtomicInteger();
// usage.produceIntegers(10, null,
// () -> new ProducerRecord<>(topic, counter.getAndIncrement()))).start();
//
// await().atMost(2, TimeUnit.MINUTES).until(() -> messages1.size() >= 10);
//
// KafkaBrokerExtension.getProxy().setConnectionCut(true);
// Thread.sleep(6000 + 500); // session timeout + a bit more just in case.
// KafkaBrokerExtension.getProxy().setConnectionCut(false);
//
// usage.produceIntegers(10, null,
// () -> new ProducerRecord<>(topic, counter.getAndIncrement()))).start();
//
// await().atMost(2, TimeUnit.MINUTES).until(() -> messages1.size() >= 20);
// assertThat(messages1.size()).isGreaterThanOrEqualTo(20);
// }
private KafkaMapBasedConfig myKafkaSourceConfig(String topic, int partitions, String withConsumerRebalanceListener, String group) {
KafkaMapBasedConfig config = kafkaConfig("mp.messaging.incoming.data");
if (group != null) {
config.put("group.id", group);
}
config.put("value.deserializer", IntegerDeserializer.class.getName());
config.put("enable.auto.commit", "false");
config.put("auto.offset.reset", "earliest");
config.put("topic", topic);
if (partitions > 0) {
config.put("partitions", Integer.toString(partitions));
}
if (withConsumerRebalanceListener != null) {
config.put("consumer-rebalance-listener.name", withConsumerRebalanceListener);
}
return config;
}
use of io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class KafkaSinkTest method getKafkaSinkConfigWithMultipleUpstreams.
private KafkaMapBasedConfig getKafkaSinkConfigWithMultipleUpstreams(String t) {
KafkaMapBasedConfig config = kafkaConfig("mp.messaging.outgoing.data");
config.put("key.serializer", StringSerializer.class.getName());
config.put("value.serializer", IntegerSerializer.class.getName());
config.put("merge", true);
if (t != null) {
config.put("topic", t);
}
return config;
}
use of io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class KafkaSinkTest method getKafkaSinkConfigForRecordProducingBean.
private KafkaMapBasedConfig getKafkaSinkConfigForRecordProducingBean(String t) {
KafkaMapBasedConfig config = kafkaConfig("mp.messaging.outgoing.output-record");
config.put("key.serializer", IntegerSerializer.class.getName());
config.put("value.serializer", StringSerializer.class.getName());
if (t != null) {
config.put("topic", t);
}
return config;
}
Aggregations