1 package de.example.spring.kafka;
3 import org.springframework.messaging.Message;
4 import org.springframework.messaging.converter.AbstractMessageConverter;
5 import org.springframework.util.MimeType;
7 public class MyCustomMessageConverter extends AbstractMessageConverter {
9 public MyCustomMessageConverter() {
10 super(new MimeType("application", "example"));
14 protected boolean supports(Class<?> clazz) {
15 return (String.class == clazz);
19 protected Object convertFromInternal(Message<?> message, Class<?> targetClass, Object conversionHint) {
20 Object payload = message.getPayload();
22 logger.info("convertFromInternal, payload: " + payload);
24 return (payload instanceof String ? payload : new String((byte[]) payload));