Example usage for org.springframework.kafka.core DefaultKafkaConsumerFactory DefaultKafkaConsumerFactory

List of usage examples for org.springframework.kafka.core DefaultKafkaConsumerFactory DefaultKafkaConsumerFactory

Introduction

In this page you can find the example usage for org.springframework.kafka.core DefaultKafkaConsumerFactory DefaultKafkaConsumerFactory.

Prototype

public DefaultKafkaConsumerFactory(Map<String, Object> configs,
        @Nullable Supplier<Deserializer<K>> keyDeserializerSupplier,
        @Nullable Supplier<Deserializer<V>> valueDeserializerSupplier) 

Source Link

Document

Construct a factory with the provided configuration and deserializer suppliers.

Usage

From source file:org.s1p.JsonConfiguration.java

@Bean
public ConsumerFactory<String, Foo> consumerFactory() {
    Map<String, Object> props = new HashMap<>();
    props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, this.configProperties.getBrokerAddress());
    props.put(ConsumerConfig.GROUP_ID_CONFIG, "s1pGroup");
    props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, true);
    props.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, 100);
    props.put(ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, 15000);
    JsonDeserializer<Foo> jsonDeserializer = new JsonDeserializer<>(Foo.class);
    return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), jsonDeserializer);
}