4d49cf8bae82d159cefef2d62afb1e38d68444cf
[JavaForFun] /
1 package de.example.spring.kafka;
2
3 import org.springframework.context.annotation.Bean;
4 import org.springframework.context.annotation.Configuration;
5 import org.springframework.messaging.converter.MessageConverter;
6
7 import com.fasterxml.jackson.databind.ObjectMapper;
8
9 @Configuration
10 public class ReceiverConfig {
11
12   @Bean
13   public Receiver receiver() {
14     return new Receiver();
15   }
16
17
18   @Bean
19   public MessageConverter customMessageConverter(ObjectMapper objectMapper) {
20           MyCustomMessageConverter converter = new MyCustomMessageConverter();
21           converter.setSerializedPayloadClass(String.class);
22           if (objectMapper != null) {
23                   converter.setObjectMapper(objectMapper);
24           }
25           
26           return converter;
27   }
28
29
30 //  @Bean
31 //  public MessageConverter avroMessageConverter() throws IOException {
32 //      AvroSchemaMessageConverter converter = new AvroSchemaMessageConverter(MimeType.valueOf("avro/bytes"));
33 //      //converter.setSchemaLocation(new ClassPathResource("schemas/User.avro"));
34 //      return converter;
35 //  }
36 }