Class DefaultAmqpHeaderMapper
java.lang.Object
org.springframework.integration.mapping.AbstractHeaderMapper<MessageProperties>
org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper
- All Implemented Interfaces:
Aware,BeanClassLoaderAware,AmqpHeaderMapper,RequestReplyHeaderMapper<MessageProperties>
public class DefaultAmqpHeaderMapper
extends AbstractHeaderMapper<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
- Author:
- Mark Fisher, Oleg Zhurakousky, Gary Russell, Artem Bilan, Stephane Nicoll, Steve Singer
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.integration.mapping.AbstractHeaderMapper
AbstractHeaderMapper.CompositeHeaderMatcher, AbstractHeaderMapper.ContentBasedHeaderMatcher, AbstractHeaderMapper.HeaderMatcher, AbstractHeaderMapper.PatternBasedHeaderMatcher, AbstractHeaderMapper.PrefixBasedMatcher, 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
ConstructorsModifierConstructorDescriptionprotectedDefaultAmqpHeaderMapper(String[] requestHeaderNames, String[] replyHeaderNames) -
Method Summary
Modifier and TypeMethodDescriptionextractStandardHeaders(MessageProperties amqpMessageProperties) Extract "standard" headers from an AMQP MessageProperties instance.extractUserDefinedHeaders(MessageProperties amqpMessageProperties) Extract user-defined headers from an AMQP MessageProperties instance.static DefaultAmqpHeaderMapperConstruct a default inbound header mapper.static String[]static String[]static DefaultAmqpHeaderMapperConstruct a default outbound header mapper.static String[]static String[]protected voidpopulateStandardHeaders(Map<String, Object> allHeaders, Map<String, Object> headers, MessageProperties amqpMessageProperties) Maps headers from a Spring Integration MessageHeaders instance to the MessageProperties of an AMQP Message.protected voidpopulateStandardHeaders(Map<String, Object> headers, MessageProperties amqpMessageProperties) Maps headers from a Spring Integration MessageHeaders instance to the MessageProperties of an AMQP Message.protected voidpopulateUserDefinedHeader(String headerName, Object headerValue, MessageProperties amqpMessageProperties) Populate the specified user-defined headers to the specified source.Map from the given request object to abstractedMessageHeaders.Methods inherited from class org.springframework.integration.mapping.AbstractHeaderMapper
createDefaultHeaderMatcher, createHeaderMatcher, createTargetPropertyName, fromHeadersToReply, fromHeadersToRequest, getClassLoader, getHeaderIfAvailable, getTransientHeaderNames, setBeanClassLoader, setReplyHeaderNames, setRequestHeaderNames, toHeadersFromReplyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.integration.mapping.RequestReplyHeaderMapper
fromHeadersToReply, fromHeadersToRequest, toHeadersFromReply
-
Constructor Details
-
DefaultAmqpHeaderMapper
-
-
Method Details
-
extractStandardHeaders
Extract "standard" headers from an AMQP MessageProperties instance.- Specified by:
extractStandardHeadersin classAbstractHeaderMapper<MessageProperties>- Parameters:
amqpMessageProperties- the source object to extract standard headers.- Returns:
- the map of headers to be mapped.
-
extractUserDefinedHeaders
Extract user-defined headers from an AMQP MessageProperties instance.- Specified by:
extractUserDefinedHeadersin classAbstractHeaderMapper<MessageProperties>- Parameters:
amqpMessageProperties- the source object to extract user defined headers.- Returns:
- the map of headers to be mapped.
-
populateStandardHeaders
protected void populateStandardHeaders(Map<String, Object> headers, MessageProperties amqpMessageProperties) Maps headers from a Spring Integration MessageHeaders instance to the MessageProperties of an AMQP Message.- Specified by:
populateStandardHeadersin classAbstractHeaderMapper<MessageProperties>- Parameters:
headers- the map of standard headers to be populated.amqpMessageProperties- the target object to populate headers.
-
populateStandardHeaders
protected void populateStandardHeaders(@Nullable Map<String, Object> allHeaders, Map<String, Object> headers, MessageProperties amqpMessageProperties) Maps headers from a Spring Integration MessageHeaders instance to the MessageProperties of an AMQP Message.- Overrides:
populateStandardHeadersin classAbstractHeaderMapper<MessageProperties>- Parameters:
allHeaders- all headers including transient.headers- the map of standard headers to be populated.amqpMessageProperties- the target object to populate headers.
-
populateUserDefinedHeader
protected void populateUserDefinedHeader(String headerName, Object headerValue, MessageProperties amqpMessageProperties) Description copied from class:AbstractHeaderMapperPopulate the specified user-defined headers to the specified source.- Specified by:
populateUserDefinedHeaderin classAbstractHeaderMapper<MessageProperties>- Parameters:
headerName- the user defined header name to be populated.headerValue- the user defined header value to be populated.amqpMessageProperties- the target object to populate headers.
-
toHeadersFromRequest
Description copied from interface:RequestReplyHeaderMapperMap from the given request object to abstractedMessageHeaders.- Specified by:
toHeadersFromRequestin interfaceRequestReplyHeaderMapper<MessageProperties>- Overrides:
toHeadersFromRequestin classAbstractHeaderMapper<MessageProperties>- Parameters:
source- the native target request- Returns:
- the abstracted MessageHeaders
-
inboundMapper
Construct a default inbound header mapper.- Returns:
- the mapper.
- Since:
- 4.3
- See Also:
-
outboundMapper
Construct a default outbound header mapper.- Returns:
- the mapper.
- Since:
- 4.3
- See Also:
-
inboundRequestHeaders
- Returns:
- the default request headers for an inbound mapper.
- Since:
- 4.3
-
inboundReplyHeaders
- Returns:
- the default reply headers for an inbound mapper.
- Since:
- 4.3
-
outboundRequestHeaders
- Returns:
- the default request headers for an outbound mapper.
- Since:
- 4.3
-
outboundReplyHeaders
- Returns:
- the default reply headers for an outbound mapper.
- Since:
- 4.3
-