Class JsonMessageConverter

    • Constructor Detail

      • JsonMessageConverter

        public JsonMessageConverter()
      • JsonMessageConverter

        public JsonMessageConverter​(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
    • Method Detail

      • setTypeMapper

        public void setTypeMapper​(Jackson2JavaTypeMapper typeMapper)
        Set a customized type mapper.
        Parameters:
        typeMapper - the type mapper.
      • getObjectMapper

        protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
        Return the object mapper.
        Returns:
        the mapper.
      • initialRecordHeaders

        protected org.apache.kafka.common.header.Headers initialRecordHeaders​(org.springframework.messaging.Message<?> message)
        Description copied from class: MessagingMessageConverter
        Subclasses can populate additional headers before they are mapped.
        Overrides:
        initialRecordHeaders in class MessagingMessageConverter
        Parameters:
        message - the message.
        Returns:
        the headers
      • convertPayload

        protected java.lang.Object convertPayload​(org.springframework.messaging.Message<?> message)
        Description copied from class: MessagingMessageConverter
        Subclasses can convert the payload; by default, it's sent unchanged to Kafka.
        Overrides:
        convertPayload in class MessagingMessageConverter
        Parameters:
        message - the message.
        Returns:
        the payload.
      • extractAndConvertValue

        protected java.lang.Object extractAndConvertValue​(org.apache.kafka.clients.consumer.ConsumerRecord<?,​?> record,
                                                          java.lang.reflect.Type type)
        Description copied from class: MessagingMessageConverter
        Subclasses can convert the value; by default, it's returned as provided by Kafka unless there is a SmartMessageConverter that can convert it.
        Overrides:
        extractAndConvertValue in class MessagingMessageConverter
        Parameters:
        record - the record.
        type - the required type.
        Returns:
        the value.