use of io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class HealthCheckTest method testHealthOfApplicationWithChannelUsingTopicVerification.
@Test
public void testHealthOfApplicationWithChannelUsingTopicVerification() {
KafkaMapBasedConfig config = getKafkaSourceConfig(topic).put("health-readiness-topic-verification", true);
LazyConsumingBean bean = runApplication(config, LazyConsumingBean.class);
companion.produceIntegers().usingGenerator(i -> new ProducerRecord<>(topic, "key", i), 10);
await().until(this::isStarted);
await().until(this::isReady);
await().until(this::isAlive);
// before subscription to channel
Multi<Integer> channel = bean.getChannel();
channel.select().first(10).collect().asList().await().atMost(Duration.ofSeconds(10));
// after subscription to channel
HealthReport startup = getHealth().getStartup();
HealthReport liveness = getHealth().getLiveness();
HealthReport readiness = getHealth().getReadiness();
assertThat(startup.isOk()).isTrue();
assertThat(liveness.isOk()).isTrue();
assertThat(readiness.isOk()).isTrue();
assertThat(startup.getChannels()).hasSize(1);
assertThat(liveness.getChannels()).hasSize(1);
assertThat(readiness.getChannels()).hasSize(1);
}
use of io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class BatchFailureHandlerTest method getIgnoreConfig.
private KafkaMapBasedConfig getIgnoreConfig(String topic) {
KafkaMapBasedConfig config = kafkaConfig("mp.messaging.incoming.kafka");
config.put("topic", topic);
config.put("group.id", topic + "-group");
config.put("value.deserializer", IntegerDeserializer.class.getName());
config.put("enable.auto.commit", "false");
config.put("auto.offset.reset", "earliest");
config.put("failure-strategy", "ignore");
config.put("batch", true);
config.put("max.poll.records", 3);
return config;
}
use of io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class BatchFailureHandlerTest method getFailConfig.
private KafkaMapBasedConfig getFailConfig(String topic) {
KafkaMapBasedConfig config = kafkaConfig("mp.messaging.incoming.kafka");
config.put("group.id", topic + "-group");
config.put("topic", topic);
config.put("value.deserializer", IntegerDeserializer.class.getName());
config.put("enable.auto.commit", "false");
config.put("auto.offset.reset", "earliest");
config.put("failure-strategy", "fail");
config.put("batch", true);
config.put("max.poll.records", 3);
return config;
}
use of io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class BatchFailureHandlerTest method getDeadLetterQueueWithCustomConfig.
private KafkaMapBasedConfig getDeadLetterQueueWithCustomConfig(String topic, String dq) {
KafkaMapBasedConfig config = kafkaConfig("mp.messaging.incoming.kafka");
config.put("topic", topic);
config.put("group.id", topic + "-group");
config.put("value.deserializer", IntegerDeserializer.class.getName());
config.put("enable.auto.commit", "false");
config.put("auto.offset.reset", "earliest");
config.put("failure-strategy", "dead-letter-queue");
config.put("dead-letter-queue.topic", dq);
config.put("dead-letter-queue.key.serializer", IntegerSerializer.class.getName());
config.put("dead-letter-queue.value.serializer", IntegerSerializer.class.getName());
config.put("batch", true);
config.put("max.poll.records", 3);
return config;
}
use of io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig in project smallrye-reactive-messaging by smallrye.
the class KafkaFailureHandlerTest method getDeadLetterQueueWithCustomConfig.
private KafkaMapBasedConfig getDeadLetterQueueWithCustomConfig(String topic, String dq) {
KafkaMapBasedConfig config = kafkaConfig("mp.messaging.incoming.kafka");
config.put("group.id", UUID.randomUUID().toString());
config.put("topic", topic);
config.put("value.deserializer", IntegerDeserializer.class.getName());
config.put("enable.auto.commit", "false");
config.put("auto.offset.reset", "earliest");
config.put("failure-strategy", "dead-letter-queue");
config.put("dead-letter-queue.topic", dq);
config.put("dead-letter-queue.key.serializer", IntegerSerializer.class.getName());
config.put("dead-letter-queue.value.serializer", IntegerSerializer.class.getName());
return config;
}
Aggregations