Class MessageBuilder<T>
java.lang.Object
org.springframework.integration.support.AbstractIntegrationMessageBuilder<T>
org.springframework.integration.support.BaseMessageBuilder<T,MessageBuilder<T>>
org.springframework.integration.support.MessageBuilder<T>
- Type Parameters:
T
- the payload type.
The default message builder; creates immutable
GenericMessage
s.
Named MessageBuilder instead of DefaultMessageBuilder for backwards
compatibility.- Author:
- Arjen Poutsma, Mark Fisher, Oleg Zhurakousky, Dave Syer, Gary Russell, Artem Bilan
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> MessageBuilder<T>
fromMessage
(Message<T> message) Create a builder for a newMessage
instance pre-populated with all the headers copied from the provided message.static <T> MessageBuilder<T>
withPayload
(T payload) Create a builder for a newMessage
instance with the provided payload.Methods inherited from class org.springframework.integration.support.BaseMessageBuilder
build, copyHeaders, copyHeadersIfAbsent, getCorrelationId, getHeader, getHeaders, getPayload, getSequenceDetails, getSequenceNumber, getSequenceSize, popSequenceDetails, pushSequenceDetails, readOnlyHeaders, removeHeader, removeHeaders, setCorrelationId, setErrorChannel, setErrorChannelName, setExpirationDate, setExpirationDate, setHeader, setHeaderIfAbsent, setPriority, setReplyChannel, setReplyChannelName, setSequenceNumber, setSequenceSize
Methods inherited from class org.springframework.integration.support.AbstractIntegrationMessageBuilder
cloneMessageHistoryIfAny, filterAndCopyHeadersIfAbsent
-
Method Details
-
fromMessage
Create a builder for a newMessage
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
Create a builder for a newMessage
instance with the provided payload.- Type Parameters:
T
- The type of the payload.- Parameters:
payload
- the payload for the new message- Returns:
- A MessageBuilder.
-