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
ModifierConstructorDescriptionprotected
DefaultAmqpHeaderMapper
(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 DefaultAmqpHeaderMapper
Construct a default inbound header mapper.static String[]
static String[]
static DefaultAmqpHeaderMapper
Construct a default outbound header mapper.static String[]
static String[]
protected void
populateStandardHeaders
(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 void
populateStandardHeaders
(Map<String, Object> headers, MessageProperties amqpMessageProperties) Maps headers from a Spring Integration MessageHeaders instance to the MessageProperties of an AMQP Message.protected void
populateUserDefinedHeader
(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, 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
-
-
Method Details
-
extractStandardHeaders
Extract "standard" headers from an AMQP MessageProperties instance.- Specified by:
extractStandardHeaders
in 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:
extractUserDefinedHeaders
in 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:
populateStandardHeaders
in 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:
populateStandardHeaders
in 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:AbstractHeaderMapper
Populate the specified user-defined headers to the specified source.- Specified by:
populateUserDefinedHeader
in 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:RequestReplyHeaderMapper
Map from the given request object to abstractedMessageHeaders
.- Specified by:
toHeadersFromRequest
in interfaceRequestReplyHeaderMapper<MessageProperties>
- Overrides:
toHeadersFromRequest
in 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
-