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.

    Fields inherited from class org.springframework.messaging.support.MessageHeaderAccessor

    DEFAULT_CHARSET
  • 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 a Closeable 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

  • 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 for readOnly mode. Defaults to MessageHeaders.ID and MessageHeaders.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 a Closeable that needs to remain open until the payload is consumed, the resource will be added to this header. After the payload is consumed the Closeable 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

      @Nullable public AcknowledgmentCallback 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 class org.springframework.messaging.support.MessageHeaderAccessor
    • isReadOnly

      public boolean isReadOnly​(java.lang.String headerName)
      Overrides:
      isReadOnly in class org.springframework.messaging.support.MessageHeaderAccessor
    • toMap

      public java.util.Map<java.lang.String,​java.lang.Object> toMap()
      Overrides:
      toMap in class org.springframework.messaging.support.MessageHeaderAccessor