Refactor AbstractHeaderMapper

This commit updates AbstractHeaderMapper in a number of ways:

* The 'userDefinedHeaderPrefix' property has been removed as some
  advanced tests revealed that the feature is actually broken right
  now and there is no easy way to fix it. A new richer hook point
  that indicates if the property comes from the target object or the
  standard MessageHeaders has been added.
* A HeaderMatcher interface has been introduced to replace the
  lengthy checks in shouldMapHeader. Several implementations
  of that interface are provided
* An additional pattern has been added that maps any header that is
  *not* a standard header. It uses the standardHeaderPrefix property
  for that purpose
* A number of protected method that were only used to create the
  instance have been removed in favour of a non default constructor.
  Subclasses should provide those *static* values in their own default
  constructor.
* The list of transient headers can now be customized. Transient
  headers are headers that should never be mapped. The standard
  ErrorChannel and ReplyChannel headers have also been removed from
  the default transient headers list as they no longer need to be
  transient

header-mapper: Polishing
This commit is contained in:
Stéphane Nicoll
2014-08-19 12:01:10 +03:00
committed by Artem Bilan
parent 84421fd91c
commit 463c185b38
16 changed files with 988 additions and 263 deletions

View File

@@ -698,7 +698,7 @@ public Object handle(@Payload String payload, @Header(AmqpHeaders.CHANNEL) Chann
"pollable" option for a publish-subscribe-channel; it must be message-driven.
</para>
</section>
<section>
<section id="amqp-message-headers">
<title>AMQP Message Headers</title>
<para>
The Spring Integration AMPQ Adapters will map standard AMQP properties
@@ -724,6 +724,15 @@ public Object handle(@Payload String payload, @Header(AmqpHeaders.CHANNEL) Chann
if you need to copy all user-defined headers simply use the wild-card
character '*'.
</tip>
<para>
Starting with <emphasis>version 4.1</emphasis>, the <classname>AbstractHeaderMapper</classname>
(a <classname>DefaultAmqpHeaderMapper</classname> superclass) allows the <code>NON_STANDARD_HEADERS</code>
token to be configured for the <emphasis>requestHeaderNames</emphasis> and/or <emphasis>replyHeaderNames</emphasis>
properties (in addition to existing <code>STANDARD_REQUEST_HEADERS</code> and <code>
STANDARD_REPLY_HEADERS</code>) to map all user-defined headers. Note, it is recommended to use the
combination like this <code>STANDARD_REPLY_HEADERS, NON_STANDARD_HEADERS</code> instead of
generic <code>*</code>, to avoid mapping of <emphasis>request</emphasis> headers to the reply.
</para>
<para>
Class <classname><ulink url="http://static.springsource.org/spring-integration/api/org/springframework/integration/amqp/AmqpHeaders.html">AmqpHeaders</ulink></classname>
identifies the default headers that will be used by the

View File

@@ -146,5 +146,13 @@
See <xref linkend="recipient-list-router-management"/> for more information.
</para>
</section>
<section id="4.1-AbstractHeaderMapper-changes">
<title>AbstractHeaderMapper: NON_STANDARD_HEADERS token</title>
<para>
The <classname>AbstractHeaderMapper</classname> implementations now provides the additional
<code>NON_STANDARD_HEADERS</code> token to map any user-defined headers, which aren't mapped by default.
See <xref linkend="amqp-message-headers"/> for more information.
</para>
</section>
</section>
</chapter>