Class MessageBuilder<T>

Type Parameters:
T - the payload type.

public final class MessageBuilder<T> extends BaseMessageBuilder<T,MessageBuilder<T>>
The default message builder; creates immutable GenericMessages. Named MessageBuilder instead of DefaultMessageBuilder for backwards compatibility.
Author:
Arjen Poutsma, Mark Fisher, Oleg Zhurakousky, Dave Syer, Gary Russell, Artem Bilan
  • Method Details

    • fromMessage

      public static <T> MessageBuilder<T> fromMessage(Message<T> message)
      Create a builder for a new Message instance pre-populated with all the headers copied from the provided message. The payload of the provided Message will also be used as the payload for the new message.
      Type Parameters:
      T - The type of the payload.
      Parameters:
      message - the Message from which the payload and all headers will be copied
      Returns:
      A MessageBuilder.
    • withPayload

      public static <T> MessageBuilder<T> withPayload(T payload)
      Create a builder for a new Message instance with the provided payload.
      Type Parameters:
      T - The type of the payload.
      Parameters:
      payload - the payload for the new message
      Returns:
      A MessageBuilder.