INT-1834: Register Beans for Annotated Handlers

JIRA: https://jira.springsource.org/browse/INT-1834

The general issue has been raised about `MessageHistory` for annotated endpoints (`@ServiceActivator`, `@Transformer` etc.)

* Register generated `MessageHandler`s as beans with concrete names based on component, method and annotation.
* Add tests and docs

In addition revert the version for JRuby to 1.7.8 as other latests versions have a NPE issue around `System.console()`

Doc Polishing
This commit is contained in:
Artem Bilan
2014-03-03 19:22:36 +02:00
committed by Gary Russell
parent 12287056d3
commit 5d2820dfbe
13 changed files with 46 additions and 29 deletions

View File

@@ -326,6 +326,15 @@ public class FooService {
still available. For more detail see <xref linkend="bridge"/>.
</note>
</para>
<para>
The processing of these annotations creates the same beans (<classname>EventDrivenConsumer</classname>s and
<interfacename>MessageHandler</interfacename>s) as with similar xml components. The bean names are generated
with this pattern:
<code>[componentName].[methodName].[annotationClassShortName]</code> for the <classname>EventDrivenConsumer</classname>
endpoint and the same name with an additional <code>.handler</code> suffix for
the <interfacename>MessageHandler</interfacename> bean. The
<interfacename>MessageHandler</interfacename>s are also eligible to be tracked by <xref linkend="message-history"/>.
</para>
<para>
Also see <xref linkend="advising-with-annotations"/>.
</para>

View File

@@ -70,7 +70,8 @@ assertEquals("sampleChain", chainHistory.get("name"));]]></programlisting>
</para>
<important>
If multiple beans (declared by <code>@EnableMessageHistory</code> and/or <code>&lt;message-history/&gt;</code>) they
all must have identical component name patterns (when trimmed and sorted).
all must have identical component name patterns (when trimmed and sorted). <emphasis role="bold">Do not use a generic
<code>&lt;bean/&gt;</code> definition for the <classname>MessageHistoryConfigurer</classname></emphasis>.
</important>
<note>
Remember that by definition the Message History header is immutable (you can't re-write history, although some try). Therefore, when writing

View File

@@ -40,7 +40,9 @@
<para>
Message history can now be enabled with the <code>@EnableMessageHistory</code> annotation in a
<code>@Configuration</code> class; in addition the message history settings can be modified
by a JMX MBean. For more information, see <xref linkend="message-history"/>.
by a JMX MBean. In addition auto-created <interfacename>MessageHandler</interfacename>s for
annotated endpoints (e.g. <classname>@ServiceActivator</classname>, <classname>@Splitter</classname> etc.)
now are also trackable by <code>MessageHistory</code>. For more information, see <xref linkend="message-history"/>.
</para>
</section>
<section id="4.0-messaging-gateway">