Search in sources :

Example 71 with KafkaMapBasedConfig

use of io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig in project smallrye-reactive-messaging by smallrye.

the class KafkaFailureHandlerTest method getIgnoreConfig.

private KafkaMapBasedConfig getIgnoreConfig(String topic) {
    KafkaMapBasedConfig config = kafkaConfig("mp.messaging.incoming.kafka");
    config.put("topic", topic);
    config.put("group.id", UUID.randomUUID().toString());
    config.put("value.deserializer", IntegerDeserializer.class.getName());
    config.put("enable.auto.commit", "false");
    config.put("auto.offset.reset", "earliest");
    config.put("failure-strategy", "ignore");
    return config;
}
Also used : IntegerDeserializer(org.apache.kafka.common.serialization.IntegerDeserializer) KafkaMapBasedConfig(io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig)

Example 72 with KafkaMapBasedConfig

use of io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig in project smallrye-reactive-messaging by smallrye.

the class KafkaFailureHandlerTest method getFailConfig.

private KafkaMapBasedConfig getFailConfig(String topic) {
    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", "fail");
    return config;
}
Also used : IntegerDeserializer(org.apache.kafka.common.serialization.IntegerDeserializer) KafkaMapBasedConfig(io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig)

Example 73 with KafkaMapBasedConfig

use of io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig in project smallrye-reactive-messaging by smallrye.

the class KafkaFailureHandlerTest method getDeadLetterQueueConfig.

private KafkaMapBasedConfig getDeadLetterQueueConfig() {
    KafkaMapBasedConfig config = kafkaConfig("mp.messaging.incoming.kafka");
    config.put("topic", "dead-letter-default");
    config.put("group.id", UUID.randomUUID().toString());
    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");
    return config;
}
Also used : IntegerDeserializer(org.apache.kafka.common.serialization.IntegerDeserializer) KafkaMapBasedConfig(io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig)

Example 74 with KafkaMapBasedConfig

use of io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig in project smallrye-reactive-messaging by smallrye.

the class KafkaNackPropagationTest method getPassedNackConfig.

private KafkaMapBasedConfig getPassedNackConfig(String topic) {
    KafkaMapBasedConfig config = kafkaConfig("mp.messaging.outgoing.kafka");
    config.put("value.serializer", IntegerSerializer.class.getName());
    config.put("topic", topic);
    return config;
}
Also used : IntegerSerializer(org.apache.kafka.common.serialization.IntegerSerializer) KafkaMapBasedConfig(io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig)

Example 75 with KafkaMapBasedConfig

use of io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig in project smallrye-reactive-messaging by smallrye.

the class KafkaNackWithMetadataTest method config.

private KafkaMapBasedConfig config() {
    KafkaMapBasedConfig builder = kafkaConfig("mp.messaging.outgoing.main-producer");
    builder.put("topic", topic);
    builder.put("key.serializer", StringSerializer.class.getName());
    builder.put("value.serializer", StringSerializer.class.getName());
    builder.withPrefix("mp.messaging.incoming.main-consumer");
    builder.put("topic", topic);
    builder.put("key.deserializer", StringDeserializer.class.getName());
    builder.put("value.deserializer", StringDeserializer.class.getName());
    builder.put("auto.offset.reset", "earliest");
    builder.put("failure-strategy", "dead-letter-queue");
    builder.put("dead-letter-queue.topic", topic + "-dlt");
    builder.put("dead-letter-queue.key.serializer", StringSerializer.class.getName());
    builder.put("dead-letter-queue.value.serializer", StringSerializer.class.getName());
    builder.withPrefix("mp.messaging.incoming.dlt-consumer");
    builder.put("topic", topic + "-dlt");
    builder.put("key.deserializer", StringDeserializer.class.getName());
    builder.put("value.deserializer", StringDeserializer.class.getName());
    builder.put("auto.offset.reset", "earliest");
    return builder;
}
Also used : StringDeserializer(org.apache.kafka.common.serialization.StringDeserializer) StringSerializer(org.apache.kafka.common.serialization.StringSerializer) KafkaMapBasedConfig(io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig)

Aggregations

KafkaMapBasedConfig (io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig)86 Test (org.junit.jupiter.api.Test)56 Message (org.eclipse.microprofile.reactive.messaging.Message)34 RecordHeader (org.apache.kafka.common.header.internals.RecordHeader)30 StringSerializer (org.apache.kafka.common.serialization.StringSerializer)25 StringDeserializer (org.apache.kafka.common.serialization.StringDeserializer)22 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)20 JsonObject (io.vertx.core.json.JsonObject)19 ArrayList (java.util.ArrayList)18 KafkaConnectorIncomingConfiguration (io.smallrye.reactive.messaging.kafka.KafkaConnectorIncomingConfiguration)17 KafkaConnectorOutgoingConfiguration (io.smallrye.reactive.messaging.kafka.KafkaConnectorOutgoingConfiguration)17 KafkaSink (io.smallrye.reactive.messaging.kafka.impl.KafkaSink)17 IncomingKafkaCloudEventMetadata (io.smallrye.reactive.messaging.kafka.IncomingKafkaCloudEventMetadata)14 IntegerDeserializer (org.apache.kafka.common.serialization.IntegerDeserializer)14 IntegerSerializer (org.apache.kafka.common.serialization.IntegerSerializer)13 JsonObjectDeserializer (io.vertx.kafka.client.serialization.JsonObjectDeserializer)5 Header (org.apache.kafka.common.header.Header)5 HealthReport (io.smallrye.reactive.messaging.health.HealthReport)4 KafkaCompanionTestBase (io.smallrye.reactive.messaging.kafka.base.KafkaCompanionTestBase)3 List (java.util.List)3