Example usage for org.springframework.kafka.support.serializer JsonDeserializer JsonDeserializer

List of usage examples for org.springframework.kafka.support.serializer JsonDeserializer JsonDeserializer

Introduction

In this page you can find the example usage for org.springframework.kafka.support.serializer JsonDeserializer JsonDeserializer.

Prototype

public JsonDeserializer(TypeReference<? super T> targetType) 

Source Link

Document

Construct an instance with the provided target type, and a default ObjectMapper .

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);
}