Class AbstractIntegrationMessageBuilder<T>
java.lang.Object
org.springframework.integration.support.AbstractIntegrationMessageBuilder<T>
- Type Parameters:
T
- the payload type.
- Direct Known Subclasses:
MessageBuilder
,MutableMessageBuilder
- Since:
- 4.0
- Author:
- Gary Russell, Artem Bilan
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Make a copy ofMessageHistory
header (if present) for a new message to build.abstract AbstractIntegrationMessageBuilder<T>
copyHeaders
(Map<String, ?> headersToCopy) Copy the name-value pairs from the provided Map.abstract AbstractIntegrationMessageBuilder<T>
copyHeadersIfAbsent
(Map<String, ?> headersToCopy) Copy the name-value pairs from the provided Map.filterAndCopyHeadersIfAbsent
(Map<String, ?> headersToCopy, String... headerPatternsToFilter) Remove headers from the provided map matching to the provided pattens and only after that copy the result into the target message headers.protected abstract Object
abstract <V> V
abstract T
protected abstract Object
protected abstract Object
pushSequenceDetails
(Object correlationId, int sequenceNumber, int sequenceSize) abstract AbstractIntegrationMessageBuilder<T>
removeHeader
(String headerName) Remove the value for the given header name.abstract AbstractIntegrationMessageBuilder<T>
removeHeaders
(String... headerPatterns) Removes all headers provided via array of 'headerPatterns'.setCorrelationId
(Object correlationId) setErrorChannel
(MessageChannel errorChannel) setErrorChannelName
(String errorChannelName) setExpirationDate
(Long expirationDate) setExpirationDate
(Date expirationDate) abstract AbstractIntegrationMessageBuilder<T>
Set the value for the given header name.abstract AbstractIntegrationMessageBuilder<T>
setHeaderIfAbsent
(String headerName, Object headerValue) Set the value for the given header name only if the header name is not already associated with a value.setPriority
(Integer priority) setReplyChannel
(MessageChannel replyChannel) setReplyChannelName
(String replyChannelName) setSequenceNumber
(Integer sequenceNumber) setSequenceSize
(Integer sequenceSize)
-
Constructor Details
-
AbstractIntegrationMessageBuilder
public AbstractIntegrationMessageBuilder()
-
-
Method Details
-
setExpirationDate
-
setExpirationDate
-
setCorrelationId
-
pushSequenceDetails
public AbstractIntegrationMessageBuilder<T> pushSequenceDetails(Object correlationId, int sequenceNumber, int sequenceSize) -
popSequenceDetails
-
setReplyChannel
-
setReplyChannelName
-
setErrorChannel
-
setErrorChannelName
-
setSequenceNumber
-
setSequenceSize
-
setPriority
-
filterAndCopyHeadersIfAbsent
public AbstractIntegrationMessageBuilder<T> filterAndCopyHeadersIfAbsent(Map<String, ?> headersToCopy, @Nullable String... headerPatternsToFilter) Remove headers from the provided map matching to the provided pattens and only after that copy the result into the target message headers.- Parameters:
headersToCopy
- a map of headers to copy.headerPatternsToFilter
- an arrays of header patterns to filter before copying.- Returns:
- the current
AbstractIntegrationMessageBuilder
. - Since:
- 5.1
- See Also:
-
cloneMessageHistoryIfAny
Make a copy ofMessageHistory
header (if present) for a new message to build.- Returns:
- the current
AbstractIntegrationMessageBuilder
. - Since:
- 6.3
-
getSequenceDetails
-
getCorrelationId
-
getSequenceNumber
-
getSequenceSize
-
getPayload
-
getHeaders
-
getHeader
-
setHeader
public abstract AbstractIntegrationMessageBuilder<T> setHeader(String headerName, @Nullable Object headerValue) Set the value for the given header name. If the provided value isnull
, the header will be removed.- Parameters:
headerName
- The header name.headerValue
- The header value.- Returns:
- this.
-
setHeaderIfAbsent
public abstract AbstractIntegrationMessageBuilder<T> setHeaderIfAbsent(String headerName, Object headerValue) Set the value for the given header name only if the header name is not already associated with a value.- Parameters:
headerName
- The header name.headerValue
- The header value.- Returns:
- this.
-
removeHeaders
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".- Parameters:
headerPatterns
- The header patterns.- Returns:
- this.
-
removeHeader
Remove the value for the given header name.- Parameters:
headerName
- The header name.- Returns:
- this.
-
copyHeaders
public abstract AbstractIntegrationMessageBuilder<T> copyHeaders(@Nullable Map<String, ?> headersToCopy) Copy the name-value pairs from the provided Map. This operation will overwrite any existing values. Use {copyHeadersIfAbsent(Map)
to avoid overwriting values. Note that the 'id' and 'timestamp' header values will never be overwritten.- Parameters:
headersToCopy
- The headers to copy.- Returns:
- this.
- See Also:
-
copyHeadersIfAbsent
public abstract AbstractIntegrationMessageBuilder<T> copyHeadersIfAbsent(@Nullable Map<String, ?> headersToCopy) Copy the name-value pairs from the provided Map. This operation will not overwrite any existing values.- Parameters:
headersToCopy
- The headers to copy.- Returns:
- this.
-
build
-