Search in sources :

Example 66 with KafkaMapBasedConfig

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

the class DocumentationTest method getProducerConfiguration.

private KafkaMapBasedConfig getProducerConfiguration() {
    KafkaMapBasedConfig config = kafkaConfig("mp.messaging.outgoing.prices");
    config.put("connector", "smallrye-kafka");
    config.put("value.serializer", "org.apache.kafka.common.serialization.DoubleSerializer");
    return config;
}
Also used : KafkaMapBasedConfig(io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig)

Example 67 with KafkaMapBasedConfig

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

the class DocumentationTest method testKafkaPriceMessageProducer.

@Test
public void testKafkaPriceMessageProducer() {
    ConsumerTask<String, Double> prices = companion.consumeDoubles().fromTopics("prices", 50, Duration.ofSeconds(60));
    KafkaMapBasedConfig config = getProducerConfiguration();
    addConfig(config);
    weld.addBeanClass(KafkaPriceMessageProducer.class);
    weld.disableDiscovery();
    container = weld.initialize();
    await().until(() -> prices.getRecords().size() >= 50);
}
Also used : KafkaMapBasedConfig(io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig) Test(org.junit.jupiter.api.Test)

Example 68 with KafkaMapBasedConfig

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

the class DocumentationTest method testKafkaPriceProducer.

@Test
public void testKafkaPriceProducer() {
    ConsumerTask<String, Double> prices = companion.consumeDoubles().fromTopics("prices", 50, Duration.ofSeconds(60));
    KafkaMapBasedConfig config = getProducerConfiguration();
    addConfig(config);
    weld.addBeanClass(KafkaPriceProducer.class);
    weld.disableDiscovery();
    container = weld.initialize();
    await().until(() -> prices.getRecords().size() >= 50);
}
Also used : KafkaMapBasedConfig(io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig) Test(org.junit.jupiter.api.Test)

Example 69 with KafkaMapBasedConfig

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

the class DocumentationTest method getConsumerConfiguration.

private KafkaMapBasedConfig getConsumerConfiguration() {
    KafkaMapBasedConfig config = kafkaConfig("mp.messaging.incoming.prices");
    config.put("connector", "smallrye-kafka");
    config.put("value.deserializer", "org.apache.kafka.common.serialization.DoubleDeserializer");
    return config;
}
Also used : KafkaMapBasedConfig(io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig)

Example 70 with KafkaMapBasedConfig

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

the class BatchFailureHandlerTest method getDeadLetterQueueConfig.

private KafkaMapBasedConfig getDeadLetterQueueConfig(String topic, String dq) {
    KafkaMapBasedConfig config = kafkaConfig("mp.messaging.incoming.kafka");
    config.put("topic", topic);
    config.put("group.id", "batch-dead-letter-default-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("batch", true);
    config.put("max.poll.records", 3);
    return config;
}
Also used : IntegerDeserializer(org.apache.kafka.common.serialization.IntegerDeserializer) 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