From 30669119161fb63e08d92c92b9e326329c456950 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Wed, 10 Nov 2010 12:10:19 -0500 Subject: [PATCH] INT-1501 enhanced documentation to include examples and explanation on header enricher sub-element including SpEL support --- .../reference/docbook/content-enrichment.xml | 72 +++++++++++++++++-- 1 file changed, 66 insertions(+), 6 deletions(-) diff --git a/docs/src/reference/docbook/content-enrichment.xml b/docs/src/reference/docbook/content-enrichment.xml index 016a06bc5c..2e6660ff84 100644 --- a/docs/src/reference/docbook/content-enrichment.xml +++ b/docs/src/reference/docbook/content-enrichment.xml @@ -16,13 +16,73 @@ Header Enricher - If you only need to add headers to a Message, and they are not dynamically determined by Message content, - then referencing a custom implementation may be overkill. For that reason, Spring Integration provides the - 'header-enricher' element. -
-
- ]]> + If you only need to add headers to a Message, and they are not dynamically determined by the Message content, + then referencing a custom implementation of the Transformer may be an overkill. For that reason, + Spring Integration provides the Header Enricher which is exposed via <header-enricher> element. + + + + +]]> + + + Header Enricher also provides helpful sub-elements to set well known header names. + + + + + + +]]> + + In the above configuration you can clearly see that for well known headers such as errorChannel, + correlationId, priority, replyChanneletc., instead of using generic <header> + sub-element where you would have to provide both header 'name' and 'value', you can use convenient sub-elements + allowing you to set those values directly. + + + SpEL Support + + + In Spring Integration 2.0 we are introducing convenience of + Spring Expression Language (SpEL) + to help configure many different components. Header Enricher is one of them. + A lot of times, header value cannot be defined statically and has to be computed dynamically. That is why + Header Enricher allows you to also specify bean 'ref' and 'method' that will calculate the + header value. Let's look at the following configuration: + + + + + +]]> + + + + As you can see that the computation logic to determine the header value is actually pretty simple and the + natural question would be is there a simpler way to accomplish this? And that is where SpEL shows its true power. + + + +]]> + + As you can see, with SpEL for simple cases like above we no longer have to provide a separate class and configure + it in the application context. All we need is to use expression attribute and provide a valid + SpEL expression. You can also see that 'payload' and 'headers' are bound as variables to the SpEL Evaluation Context + giving you full access to the incoming Message. + + + Adapter specific Header Enrichers + + + As you go through the manual you will see that as an added convenience + Spring Integration provides adapter specific Header Enrichers (e.g., WS, XMPP, etc.) +