Package org.springframework.integration
Class IntegrationMessageHeaderAccessor
java.lang.Object
org.springframework.messaging.support.MessageHeaderAccessor
org.springframework.integration.IntegrationMessageHeaderAccessor
public class IntegrationMessageHeaderAccessor
extends org.springframework.messaging.support.MessageHeaderAccessor
Adds standard SI Headers.
- Since:
- 4.0
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ACKNOWLEDGMENT_CALLBACK
A callback to acknowledge message delivery.static java.lang.String
CLOSEABLE_RESOURCE
static java.lang.String
CORRELATION_ID
static java.lang.String
DELIVERY_ATTEMPT
static java.lang.String
DUPLICATE_MESSAGE
static java.lang.String
EXPIRATION_DATE
static java.lang.String
PRIORITY
static java.lang.String
ROUTING_SLIP
static java.lang.String
SEQUENCE_DETAILS
static java.lang.String
SEQUENCE_NUMBER
static java.lang.String
SEQUENCE_SIZE
static java.lang.String
SOURCE_DATA
Raw source message. -
Constructor Summary
Constructors Constructor Description IntegrationMessageHeaderAccessor(org.springframework.messaging.Message<?> message)
-
Method Summary
Modifier and Type Method Description AcknowledgmentCallback
getAcknowledgmentCallback()
Return the acknowledgment callback, if present.java.io.Closeable
getCloseableResource()
If the payload was created by aCloseable
that needs to remain open until the payload is consumed, the resource will be added to this header.java.lang.Object
getCorrelationId()
java.util.concurrent.atomic.AtomicInteger
getDeliveryAttempt()
When a message-driven endpoint supports retry implicitly, this header is incremented for each delivery attempt.java.lang.Long
getExpirationDate()
<T> T
getHeader(java.lang.String key, java.lang.Class<T> type)
java.lang.Integer
getPriority()
int
getSequenceNumber()
int
getSequenceSize()
<T> T
getSourceData()
Get the source data header, if present.boolean
isReadOnly(java.lang.String headerName)
void
setReadOnlyHeaders(java.lang.String... readOnlyHeaders)
Specify a list of headers which should be considered as read only and prohibited from being populated in the message.java.util.Map<java.lang.String,java.lang.Object>
toMap()
protected void
verifyType(java.lang.String headerName, java.lang.Object headerValue)
Methods inherited from class org.springframework.messaging.support.MessageHeaderAccessor
copyHeaders, copyHeadersIfAbsent, createAccessor, getAccessor, getAccessor, getAccessor, getContentType, getDetailedLogMessage, getDetailedPayloadLogMessage, getErrorChannel, getHeader, getId, getMessageHeaders, getMutableAccessor, getReplyChannel, getShortLogMessage, getShortPayloadLogMessage, getTimestamp, isModified, isMutable, isReadableContentType, removeHeader, removeHeaders, setContentType, setErrorChannel, setErrorChannelName, setHeader, setHeaderIfAbsent, setImmutable, setLeaveMutable, setModified, setReplyChannel, setReplyChannelName, toMessageHeaders, toString
-
Field Details
-
CORRELATION_ID
public static final java.lang.String CORRELATION_ID- See Also:
- Constant Field Values
-
EXPIRATION_DATE
public static final java.lang.String EXPIRATION_DATE- See Also:
- Constant Field Values
-
PRIORITY
public static final java.lang.String PRIORITY- See Also:
- Constant Field Values
-
SEQUENCE_NUMBER
public static final java.lang.String SEQUENCE_NUMBER- See Also:
- Constant Field Values
-
SEQUENCE_SIZE
public static final java.lang.String SEQUENCE_SIZE- See Also:
- Constant Field Values
-
SEQUENCE_DETAILS
public static final java.lang.String SEQUENCE_DETAILS- See Also:
- Constant Field Values
-
ROUTING_SLIP
public static final java.lang.String ROUTING_SLIP- See Also:
- Constant Field Values
-
DUPLICATE_MESSAGE
public static final java.lang.String DUPLICATE_MESSAGE- See Also:
- Constant Field Values
-
CLOSEABLE_RESOURCE
public static final java.lang.String CLOSEABLE_RESOURCE- See Also:
- Constant Field Values
-
DELIVERY_ATTEMPT
public static final java.lang.String DELIVERY_ATTEMPT- See Also:
- Constant Field Values
-
ACKNOWLEDGMENT_CALLBACK
public static final java.lang.String ACKNOWLEDGMENT_CALLBACKA callback to acknowledge message delivery. The type of the header value depends on the context in which the header is used. See the reference manual for more information.- See Also:
- Constant Field Values
-
SOURCE_DATA
public static final java.lang.String SOURCE_DATARaw source message.- See Also:
- Constant Field Values
-
-
Constructor Details
-
IntegrationMessageHeaderAccessor
public IntegrationMessageHeaderAccessor(@Nullable org.springframework.messaging.Message<?> message)
-
-
Method Details
-
setReadOnlyHeaders
public void setReadOnlyHeaders(java.lang.String... readOnlyHeaders)Specify a list of headers which should be considered as read only and prohibited from being populated in the message.- Parameters:
readOnlyHeaders
- the list of headers forreadOnly
mode. Defaults toMessageHeaders.ID
andMessageHeaders.TIMESTAMP
.- Since:
- 4.3.2
- See Also:
isReadOnly(String)
-
getExpirationDate
@Nullable public java.lang.Long getExpirationDate() -
getCorrelationId
@Nullable public java.lang.Object getCorrelationId() -
getSequenceNumber
public int getSequenceNumber() -
getSequenceSize
public int getSequenceSize() -
getPriority
@Nullable public java.lang.Integer getPriority() -
getCloseableResource
@Nullable public java.io.Closeable getCloseableResource()If the payload was created by aCloseable
that needs to remain open until the payload is consumed, the resource will be added to this header. After the payload is consumed theCloseable
should be closed. Usually this must occur in an endpoint close to the message origin in the flow, and in the same JVM.- Returns:
- the
Closeable
. - Since:
- 4.3
-
getAcknowledgmentCallback
Return the acknowledgment callback, if present.- Returns:
- the callback.
- Since:
- 5.0.1
-
getDeliveryAttempt
@Nullable public java.util.concurrent.atomic.AtomicInteger getDeliveryAttempt()When a message-driven endpoint supports retry implicitly, this header is incremented for each delivery attempt.- Returns:
- the delivery attempt.
- Since:
- 5.0.1
-
getSourceData
@Nullable public <T> T getSourceData()Get the source data header, if present.- Type Parameters:
T
- the data type.- Returns:
- the source header.
- Since:
- 5.1.6
-
getHeader
@Nullable public <T> T getHeader(java.lang.String key, java.lang.Class<T> type) -
verifyType
protected void verifyType(java.lang.String headerName, java.lang.Object headerValue)- Overrides:
verifyType
in classorg.springframework.messaging.support.MessageHeaderAccessor
-
isReadOnly
public boolean isReadOnly(java.lang.String headerName)- Overrides:
isReadOnly
in classorg.springframework.messaging.support.MessageHeaderAccessor
-
toMap
public java.util.Map<java.lang.String,java.lang.Object> toMap()- Overrides:
toMap
in classorg.springframework.messaging.support.MessageHeaderAccessor
-