public class DefaultAmqpHeaderMapper extends AbstractHeaderMapper<MessageProperties> implements AmqpHeaderMapper
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
.
AbstractHeaderMapper.CompositeHeaderMatcher, AbstractHeaderMapper.ContentBasedHeaderMatcher, AbstractHeaderMapper.HeaderMatcher, AbstractHeaderMapper.PatternBasedHeaderMatcher, AbstractHeaderMapper.PrefixBasedMatcher, AbstractHeaderMapper.SinglePatternBasedHeaderMatcher
logger, NON_STANDARD_HEADER_NAME_PATTERN, STANDARD_REPLY_HEADER_NAME_PATTERN, STANDARD_REQUEST_HEADER_NAME_PATTERN
Modifier | Constructor and Description |
---|---|
protected |
DefaultAmqpHeaderMapper(String[] requestHeaderNames,
String[] replyHeaderNames) |
Modifier and Type | Method and Description |
---|---|
protected Map<String,Object> |
extractStandardHeaders(MessageProperties amqpMessageProperties)
Extract "standard" headers from an AMQP MessageProperties instance.
|
protected Map<String,Object> |
extractUserDefinedHeaders(MessageProperties amqpMessageProperties)
Extract user-defined headers from an AMQP MessageProperties instance.
|
static DefaultAmqpHeaderMapper |
inboundMapper()
Construct a default inbound header mapper.
|
static String[] |
inboundReplyHeaders() |
static String[] |
inboundRequestHeaders() |
static DefaultAmqpHeaderMapper |
outboundMapper()
Construct a default outbound header mapper.
|
static String[] |
outboundReplyHeaders() |
static String[] |
outboundRequestHeaders() |
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<String,Object> |
toHeadersFromRequest(MessageProperties source)
Map from the given request object to abstracted
MessageHeaders . |
createDefaultHeaderMatcher, createHeaderMatcher, createTargetPropertyName, fromHeadersToReply, fromHeadersToRequest, getClassLoader, getHeaderIfAvailable, getTransientHeaderNames, setBeanClassLoader, setReplyHeaderNames, setRequestHeaderNames, toHeadersFromReply
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fromHeadersToReply, fromHeadersToRequest, toHeadersFromReply
protected Map<String,Object> extractStandardHeaders(MessageProperties amqpMessageProperties)
extractStandardHeaders
in class AbstractHeaderMapper<MessageProperties>
amqpMessageProperties
- the source object to extract standard headers.protected Map<String,Object> extractUserDefinedHeaders(MessageProperties amqpMessageProperties)
extractUserDefinedHeaders
in class AbstractHeaderMapper<MessageProperties>
amqpMessageProperties
- the source object to extract user defined headers.protected void populateStandardHeaders(Map<String,Object> headers, MessageProperties amqpMessageProperties)
populateStandardHeaders
in class AbstractHeaderMapper<MessageProperties>
headers
- the map of standard headers to be populated.amqpMessageProperties
- the target object to populate headers.protected void populateStandardHeaders(@Nullable Map<String,Object> allHeaders, Map<String,Object> headers, MessageProperties amqpMessageProperties)
populateStandardHeaders
in class AbstractHeaderMapper<MessageProperties>
allHeaders
- all headers including transient.headers
- the map of standard headers to be populated.amqpMessageProperties
- the target object to populate headers.protected void populateUserDefinedHeader(String headerName, Object headerValue, MessageProperties amqpMessageProperties)
AbstractHeaderMapper
populateUserDefinedHeader
in class AbstractHeaderMapper<MessageProperties>
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.public Map<String,Object> toHeadersFromRequest(MessageProperties source)
RequestReplyHeaderMapper
MessageHeaders
.toHeadersFromRequest
in interface RequestReplyHeaderMapper<MessageProperties>
toHeadersFromRequest
in class AbstractHeaderMapper<MessageProperties>
source
- the native target requestpublic static DefaultAmqpHeaderMapper inboundMapper()
inboundRequestHeaders()
,
inboundReplyHeaders()
public static DefaultAmqpHeaderMapper outboundMapper()
outboundRequestHeaders()
,
outboundReplyHeaders()
public static String[] inboundRequestHeaders()
public static String[] inboundReplyHeaders()
public static String[] outboundRequestHeaders()
public static String[] outboundReplyHeaders()