Class DefaultAmqpHeaderMapper

java.lang.Object
org.springframework.integration.mapping.AbstractHeaderMapper<org.springframework.amqp.core.MessageProperties>
org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, AmqpHeaderMapper, org.springframework.integration.mapping.RequestReplyHeaderMapper<org.springframework.amqp.core.MessageProperties>

public class DefaultAmqpHeaderMapper
extends org.springframework.integration.mapping.AbstractHeaderMapper<org.springframework.amqp.core.MessageProperties>
implements AmqpHeaderMapper
Default implementation of AmqpHeaderMapper.

By default this implementation will only copy AMQP properties (e.g. contentType) to and from Spring Integration MessageHeaders. Any user-defined headers within the AMQP MessageProperties will NOT be copied to or from an AMQP Message unless explicitly identified via 'requestHeaderNames' and/or 'replyHeaderNames' (see AbstractHeaderMapper.setRequestHeaderNames(String[]) and AbstractHeaderMapper.setReplyHeaderNames(String[])} as well as 'mapped-request-headers' and 'mapped-reply-headers' attributes of the AMQP adapters). If you need to copy all user-defined headers simply use wild-card character '*'.

Constants for the AMQP header keys are defined in AmqpHeaders.

Since:
2.1
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.integration.mapping.AbstractHeaderMapper

    org.springframework.integration.mapping.AbstractHeaderMapper.CompositeHeaderMatcher, org.springframework.integration.mapping.AbstractHeaderMapper.ContentBasedHeaderMatcher, org.springframework.integration.mapping.AbstractHeaderMapper.HeaderMatcher, org.springframework.integration.mapping.AbstractHeaderMapper.PatternBasedHeaderMatcher, org.springframework.integration.mapping.AbstractHeaderMapper.PrefixBasedMatcher, org.springframework.integration.mapping.AbstractHeaderMapper.SinglePatternBasedHeaderMatcher
  • Field Summary

    Fields inherited from class org.springframework.integration.mapping.AbstractHeaderMapper

    logger, NON_STANDARD_HEADER_NAME_PATTERN, STANDARD_REPLY_HEADER_NAME_PATTERN, STANDARD_REQUEST_HEADER_NAME_PATTERN
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected DefaultAmqpHeaderMapper​(java.lang.String[] requestHeaderNames, java.lang.String[] replyHeaderNames)  
  • Method Summary

    Modifier and Type Method Description
    protected java.util.Map<java.lang.String,​java.lang.Object> extractStandardHeaders​(org.springframework.amqp.core.MessageProperties amqpMessageProperties)
    Extract "standard" headers from an AMQP MessageProperties instance.
    protected java.util.Map<java.lang.String,​java.lang.Object> extractUserDefinedHeaders​(org.springframework.amqp.core.MessageProperties amqpMessageProperties)
    Extract user-defined headers from an AMQP MessageProperties instance.
    static DefaultAmqpHeaderMapper inboundMapper()
    Construct a default inbound header mapper.
    static java.lang.String[] inboundReplyHeaders()  
    static java.lang.String[] inboundRequestHeaders()  
    static DefaultAmqpHeaderMapper outboundMapper()
    Construct a default outbound header mapper.
    static java.lang.String[] outboundReplyHeaders()  
    static java.lang.String[] outboundRequestHeaders()  
    protected void populateStandardHeaders​(java.util.Map<java.lang.String,​java.lang.Object> allHeaders, java.util.Map<java.lang.String,​java.lang.Object> headers, org.springframework.amqp.core.MessageProperties amqpMessageProperties)
    Maps headers from a Spring Integration MessageHeaders instance to the MessageProperties of an AMQP Message.
    protected void populateStandardHeaders​(java.util.Map<java.lang.String,​java.lang.Object> headers, org.springframework.amqp.core.MessageProperties amqpMessageProperties)
    Maps headers from a Spring Integration MessageHeaders instance to the MessageProperties of an AMQP Message.
    protected void populateUserDefinedHeader​(java.lang.String headerName, java.lang.Object headerValue, org.springframework.amqp.core.MessageProperties amqpMessageProperties)  
    java.util.Map<java.lang.String,​java.lang.Object> toHeadersFromRequest​(org.springframework.amqp.core.MessageProperties source)  

    Methods inherited from class org.springframework.integration.mapping.AbstractHeaderMapper

    createDefaultHeaderMatcher, createHeaderMatcher, createTargetPropertyName, fromHeadersToReply, fromHeadersToRequest, getClassLoader, getHeaderIfAvailable, getTransientHeaderNames, setBeanClassLoader, setReplyHeaderNames, setRequestHeaderNames, toHeadersFromReply

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.integration.mapping.RequestReplyHeaderMapper

    fromHeadersToReply, fromHeadersToRequest, toHeadersFromReply
  • Constructor Details

    • DefaultAmqpHeaderMapper

      protected DefaultAmqpHeaderMapper​(java.lang.String[] requestHeaderNames, java.lang.String[] replyHeaderNames)
  • Method Details

    • extractStandardHeaders

      protected java.util.Map<java.lang.String,​java.lang.Object> extractStandardHeaders​(org.springframework.amqp.core.MessageProperties amqpMessageProperties)
      Extract "standard" headers from an AMQP MessageProperties instance.
      Specified by:
      extractStandardHeaders in class org.springframework.integration.mapping.AbstractHeaderMapper<org.springframework.amqp.core.MessageProperties>
    • extractUserDefinedHeaders

      protected java.util.Map<java.lang.String,​java.lang.Object> extractUserDefinedHeaders​(org.springframework.amqp.core.MessageProperties amqpMessageProperties)
      Extract user-defined headers from an AMQP MessageProperties instance.
      Specified by:
      extractUserDefinedHeaders in class org.springframework.integration.mapping.AbstractHeaderMapper<org.springframework.amqp.core.MessageProperties>
    • populateStandardHeaders

      protected void populateStandardHeaders​(java.util.Map<java.lang.String,​java.lang.Object> headers, org.springframework.amqp.core.MessageProperties amqpMessageProperties)
      Maps headers from a Spring Integration MessageHeaders instance to the MessageProperties of an AMQP Message.
      Specified by:
      populateStandardHeaders in class org.springframework.integration.mapping.AbstractHeaderMapper<org.springframework.amqp.core.MessageProperties>
    • populateStandardHeaders

      protected void populateStandardHeaders​(@Nullable java.util.Map<java.lang.String,​java.lang.Object> allHeaders, java.util.Map<java.lang.String,​java.lang.Object> headers, org.springframework.amqp.core.MessageProperties amqpMessageProperties)
      Maps headers from a Spring Integration MessageHeaders instance to the MessageProperties of an AMQP Message.
      Overrides:
      populateStandardHeaders in class org.springframework.integration.mapping.AbstractHeaderMapper<org.springframework.amqp.core.MessageProperties>
    • populateUserDefinedHeader

      protected void populateUserDefinedHeader​(java.lang.String headerName, java.lang.Object headerValue, org.springframework.amqp.core.MessageProperties amqpMessageProperties)
      Specified by:
      populateUserDefinedHeader in class org.springframework.integration.mapping.AbstractHeaderMapper<org.springframework.amqp.core.MessageProperties>
    • toHeadersFromRequest

      public java.util.Map<java.lang.String,​java.lang.Object> toHeadersFromRequest​(org.springframework.amqp.core.MessageProperties source)
      Specified by:
      toHeadersFromRequest in interface org.springframework.integration.mapping.RequestReplyHeaderMapper<org.springframework.amqp.core.MessageProperties>
      Overrides:
      toHeadersFromRequest in class org.springframework.integration.mapping.AbstractHeaderMapper<org.springframework.amqp.core.MessageProperties>
    • inboundMapper

      public static DefaultAmqpHeaderMapper inboundMapper()
      Construct a default inbound header mapper.
      Returns:
      the mapper.
      Since:
      4.3
      See Also:
      inboundRequestHeaders(), inboundReplyHeaders()
    • outboundMapper

      public static DefaultAmqpHeaderMapper outboundMapper()
      Construct a default outbound header mapper.
      Returns:
      the mapper.
      Since:
      4.3
      See Also:
      outboundRequestHeaders(), outboundReplyHeaders()
    • inboundRequestHeaders

      public static java.lang.String[] inboundRequestHeaders()
      Returns:
      the default request headers for an inbound mapper.
      Since:
      4.3
    • inboundReplyHeaders

      public static java.lang.String[] inboundReplyHeaders()
      Returns:
      the default reply headers for an inbound mapper.
      Since:
      4.3
    • outboundRequestHeaders

      public static java.lang.String[] outboundRequestHeaders()
      Returns:
      the default request headers for an outbound mapper.
      Since:
      4.3
    • outboundReplyHeaders

      public static java.lang.String[] outboundReplyHeaders()
      Returns:
      the default reply headers for an outbound mapper.
      Since:
      4.3