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.StringACKNOWLEDGMENT_CALLBACKA callback to acknowledge message delivery.static java.lang.StringCLOSEABLE_RESOURCEstatic java.lang.StringCORRELATION_IDstatic java.lang.StringDELIVERY_ATTEMPTstatic java.lang.StringDUPLICATE_MESSAGEstatic java.lang.StringEXPIRATION_DATEstatic java.lang.StringPRIORITYstatic java.lang.StringROUTING_SLIPstatic java.lang.StringSEQUENCE_DETAILSstatic java.lang.StringSEQUENCE_NUMBERstatic java.lang.StringSEQUENCE_SIZEstatic java.lang.StringSOURCE_DATARaw source message. -
Constructor Summary
Constructors Constructor Description IntegrationMessageHeaderAccessor(org.springframework.messaging.Message<?> message) -
Method Summary
Modifier and Type Method Description AcknowledgmentCallbackgetAcknowledgmentCallback()Return the acknowledgment callback, if present.java.io.CloseablegetCloseableResource()If the payload was created by aCloseablethat needs to remain open until the payload is consumed, the resource will be added to this header.java.lang.ObjectgetCorrelationId()java.util.concurrent.atomic.AtomicIntegergetDeliveryAttempt()When a message-driven endpoint supports retry implicitly, this header is incremented for each delivery attempt.java.lang.LonggetExpirationDate()<T> TgetHeader(java.lang.String key, java.lang.Class<T> type)java.lang.IntegergetPriority()intgetSequenceNumber()intgetSequenceSize()<T> TgetSourceData()Get the source data header, if present.booleanisReadOnly(java.lang.String headerName)voidsetReadOnlyHeaders(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 voidverifyType(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 forreadOnlymode. Defaults toMessageHeaders.IDandMessageHeaders.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 aCloseablethat needs to remain open until the payload is consumed, the resource will be added to this header. After the payload is consumed theCloseableshould 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:
verifyTypein classorg.springframework.messaging.support.MessageHeaderAccessor
-
isReadOnly
public boolean isReadOnly(java.lang.String headerName)- Overrides:
isReadOnlyin classorg.springframework.messaging.support.MessageHeaderAccessor
-
toMap
public java.util.Map<java.lang.String,java.lang.Object> toMap()- Overrides:
toMapin classorg.springframework.messaging.support.MessageHeaderAccessor
-