Interface InboundMessageMapper<T>

Type Parameters:
T - the type of object to create message from.
All Known Subinterfaces:
BytesMessageMapper, MethodArgsMessageMapper
All Known Implementing Classes:
AbstractJsonInboundMessageMapper, ConvertingBytesMessageMapper, DatagramPacketMessageMapper, EmbeddedJsonHeadersMessageMapper, JsonInboundMessageMapper, MessageConvertingTcpMessageMapper, TcpMessageMapper
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface InboundMessageMapper<T>
Strategy interface for mapping from an Object to aMessage.
Author:
Mark Fisher, Artem Bilan, Gary Russell
  • Method Summary

    Modifier and Type
    Method
    Description
    default Message<?>
    toMessage(T object)
    Convert a provided object to the Message.
    toMessage(T object, Map<String,Object> headers)
    Convert a provided object to the Message and supply with headers if necessary and provided.
  • Method Details

    • toMessage

      @Nullable default Message<?> toMessage(T object)
      Convert a provided object to the Message.
      Parameters:
      object - the object for message payload or some other conversion logic
      Returns:
      the message as a result of mapping
    • toMessage

      @Nullable Message<?> toMessage(T object, @Nullable Map<String,Object> headers)
      Convert a provided object to the Message and supply with headers if necessary and provided.
      Parameters:
      object - the object for message payload or some other conversion logic
      headers - additional headers for building message. Can be null
      Returns:
      the message as a result of mapping
      Since:
      5.0