Class IntegrationMessageHeaderAccessor

java.lang.Object
org.springframework.messaging.support.MessageHeaderAccessor
org.springframework.integration.IntegrationMessageHeaderAccessor

public class IntegrationMessageHeaderAccessor extends MessageHeaderAccessor
Adds standard SI Headers.
Since:
4.0
Author:
Andy Wilkinson, Artem Bilan, Gary Russell
  • Field Details

  • Constructor Details

    • IntegrationMessageHeaderAccessor

      public IntegrationMessageHeaderAccessor(@Nullable Message<?> message)
  • Method Details

    • setReadOnlyHeaders

      public void setReadOnlyHeaders(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:
    • getExpirationDate

      @Nullable public Long getExpirationDate()
    • getCorrelationId

      @Nullable public Object getCorrelationId()
    • getSequenceNumber

      public int getSequenceNumber()
    • getSequenceSize

      public int getSequenceSize()
    • getPriority

      @Nullable public Integer getPriority()
    • getCloseableResource

      @Nullable public 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 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(String key, Class<T> type)
    • verifyType

      protected void verifyType(String headerName, Object headerValue)
      Overrides:
      verifyType in class MessageHeaderAccessor
    • isReadOnly

      public boolean isReadOnly(String headerName)
      Overrides:
      isReadOnly in class MessageHeaderAccessor
    • toMap

      public Map<String,Object> toMap()
      Overrides:
      toMap in class MessageHeaderAccessor