Example usage for org.springframework.integration.support MessageBuilder MessageBuilder

List of usage examples for org.springframework.integration.support MessageBuilder MessageBuilder

Introduction

In this page you can find the example usage for org.springframework.integration.support MessageBuilder MessageBuilder.

Prototype

private MessageBuilder(T payload, @Nullable Message<T> originalMessage) 

Source Link

Document

Private constructor to be invoked from the static factory methods only.

Usage

From source file:org.springframework.integration.support.MessageBuilder.java

/**
 * Create a builder for a new {@link Message} instance pre-populated with all of the headers copied from the
 * provided message. The payload of the provided Message will also be used as the payload for the new message.
 *
 * @param message the Message from which the payload and all headers will be copied
 * @param <T> The type of the payload.
 * @return A MessageBuilder.//from   w  ww.ja v  a 2  s. c o  m
 */
public static <T> MessageBuilder<T> fromMessage(Message<T> message) {
    Assert.notNull(message, "message must not be null");
    return new MessageBuilder<T>(message.getPayload(), message);
}

From source file:org.springframework.integration.support.MessageBuilder.java

/**
 * Create a builder for a new {@link Message} instance with the provided payload.
 *
 * @param payload the payload for the new message
 * @param <T> The type of the payload.
 * @return A MessageBuilder.//from  w w  w.j  av  a2 s.  com
 */
public static <T> MessageBuilder<T> withPayload(T payload) {
    return new MessageBuilder<T>(payload, null);
}