class MessageBuilder<T : Any>
A builder for creating a GenericMessage (or ErrorMessage if the payload is of type Throwable).
Author
Arjen Poutsma
Author
Mark Fisher
Author
Rossen Stoyanchev
Since
4.0
See Also
GenericMessageErrorMessage
fun build(): Message<T> |
|
fun copyHeaders(headersToCopy: MutableMap<String, *>): MessageBuilder<T>
Copy the name-value pairs from the provided Map. This operation will overwrite any existing values. Use { |
|
fun copyHeadersIfAbsent(headersToCopy: MutableMap<String, *>): MessageBuilder<T>
Copy the name-value pairs from the provided Map. This operation will not overwrite any existing values. |
|
static fun <T : Any> createMessage(payload: T, messageHeaders: MessageHeaders): Message<T>
A shortcut factory method for creating a message with the given payload and Note: the given |
|
static fun <T : Any> fromMessage(message: Message<T>): MessageBuilder<T>
Create a builder for a new 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. |
|
fun removeHeader(headerName: String): MessageBuilder<T>
Remove the value for the given header name. |
|
fun removeHeaders(vararg headerPatterns: String): MessageBuilder<T>
Removes all headers provided via array of 'headerPatterns'. As the name suggests the array may contain simple matching patterns for header names. Supported pattern styles are: "xxx*", "*xxx", "*xxx*" and "xxx*yyy". |
|
fun setErrorChannel(errorChannel: MessageChannel): MessageBuilder<T> |
|
fun setErrorChannelName(errorChannelName: String): MessageBuilder<T> |
|
fun setHeader(headerName: String, headerValue: Any): MessageBuilder<T>
Set the value for the given header name. If the provided value is |
|
fun setHeaderIfAbsent(headerName: String, headerValue: Any): MessageBuilder<T>
Set the value for the given header name only if the header name is not already associated with a value. |
|
fun setHeaders(accessor: MessageHeaderAccessor): MessageBuilder<T>
Set the message headers to use by providing a |
|
fun setReplyChannel(replyChannel: MessageChannel): MessageBuilder<T> |
|
fun setReplyChannelName(replyChannelName: String): MessageBuilder<T> |
|
static fun <T : Any> withPayload(payload: T): MessageBuilder<T>
Create a new builder for a message with the given payload. |