Search in sources :

Example 76 with KafkaMapBasedConfig

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

the class KafkaSourceWithLegacyMetadataTest 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", "legacy-data-starting-on-fifth-" + suffix);
    if (shorterTimeouts) {
        config.put("max.poll.interval.ms", "2000");
    }
    return config;
}
Also used : IntegerDeserializer(org.apache.kafka.common.serialization.IntegerDeserializer) KafkaMapBasedConfig(io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig)

Example 77 with KafkaMapBasedConfig

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

the class KafkaSourceWithLegacyMetadataTest 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;
}
Also used : IntegerDeserializer(org.apache.kafka.common.serialization.IntegerDeserializer) KafkaMapBasedConfig(io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig)

Example 78 with KafkaMapBasedConfig

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

the class KafkaSinkTest method testConnectorWithMultipleUpstreams.

@Test
public void testConnectorWithMultipleUpstreams() {
    ConsumerTask<String, Integer> consumed = companion.consumeIntegers().fromTopics(topic, 20);
    KafkaMapBasedConfig config = getKafkaSinkConfigWithMultipleUpstreams(topic);
    runApplication(config, BeanWithMultipleUpstreams.class);
    await().until(this::isReady);
    await().until(this::isAlive);
    assertThat(consumed.awaitCompletion(Duration.ofMinutes(1)).count()).isEqualTo(20);
    assertThat(consumed.getRecords()).extracting(ConsumerRecord::value).contains(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19);
}
Also used : KafkaMapBasedConfig(io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig) Test(org.junit.jupiter.api.Test)

Example 79 with KafkaMapBasedConfig

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

the class KafkaSinkWithLegacyMetadataTest 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;
}
Also used : IntegerSerializer(org.apache.kafka.common.serialization.IntegerSerializer) StringSerializer(org.apache.kafka.common.serialization.StringSerializer) KafkaMapBasedConfig(io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig)

Example 80 with KafkaMapBasedConfig

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

the class KafkaSinkWithLegacyMetadataTest 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;
}
Also used : StringSerializer(org.apache.kafka.common.serialization.StringSerializer) IntegerSerializer(org.apache.kafka.common.serialization.IntegerSerializer) 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