INT-3557 Clarify MessageHeaders Constants
JIRA: https://jira.spring.io/browse/INT-3557 Add class names and code tags. Add missing header constants. Polishing for `timestamp` header doc. Fix JavaDocs issues: https://build.spring.io/browse/INT-EIGHTAPI-296
This commit is contained in:
committed by
Artem Bilan
parent
0cc9273a2e
commit
0f568c0526
@@ -63,30 +63,39 @@
|
||||
The following Message headers are pre-defined:
|
||||
<table id="message-headers-table">
|
||||
<title>Pre-defined Message Headers</title>
|
||||
<tgroup cols="2">
|
||||
<tgroup cols="3">
|
||||
<colspec align="left" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry align="center">Header Name</entry>
|
||||
<entry align="center">Header Type</entry>
|
||||
<entry align="center">Usage</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>ID</entry>
|
||||
<entry>java.util.UUID</entry>
|
||||
<entry><code>MessageHeaders.ID</code></entry>
|
||||
<entry><code>java.util.UUID</code></entry>
|
||||
<entry>An identifier for this message instance. Changes each time a message is mutated.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>TIMESTAMP</entry>
|
||||
<entry>java.lang.Long</entry>
|
||||
<entry><code>MessageHeaders.TIMESTAMP</code></entry>
|
||||
<entry><code>java.lang.Long</code></entry>
|
||||
<entry>The time the message was created. Changes each time a message is mutated.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>REPLY_CHANNEL</entry>
|
||||
<entry>java.lang.Object (can be a String or MessageChannel)</entry>
|
||||
<entry><code>MessageHeaders.REPLY_CHANNEL</code></entry>
|
||||
<entry><code>java.lang.Object</code> (String or MessageChannel)</entry>
|
||||
<entry>A channel to which a reply (if any) will be sent when no explicit output
|
||||
channel is configured and there is no <code>ROUTING_SLIP</code> or the
|
||||
<code>ROUTING_SLIP</code> is exhausted. If the value is a <code>String</code>
|
||||
it must represent a bean name, or have been generated by a <classname>ChannelRegistry.</classname></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>ERROR_CHANNEL</entry>
|
||||
<entry>java.lang.Object (can be a String or MessageChannel)</entry>
|
||||
<entry><code>MessageHeaders.ERROR_CHANNEL</code></entry>
|
||||
<entry><code>java.lang.Object</code> (String or MessageChannel)</entry>
|
||||
<entry>A channel to which errors will be sent. If the value is a <code>String</code>
|
||||
it must represent a bean name, or have been generated by a <classname>ChannelRegistry.</classname></entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
@@ -94,59 +103,108 @@
|
||||
</para>
|
||||
<para>
|
||||
Many inbound and outbound adapter implementations will also provide and/or expect certain headers, and additional
|
||||
user-defined headers can also be configured.
|
||||
user-defined headers can also be configured. Constants for these headers can be found in those modules where such
|
||||
headers exist, for example <classname>AmqpHeaders</classname>, <classname>JmsHeaders</classname> etc.
|
||||
</para>
|
||||
<section id="message-header-accessor">
|
||||
<title>MessageHeaderAccessor API</title>
|
||||
<para>
|
||||
Since Spring Framework 4.0 and Spring Integration 4.0, the core Messaging abstraction has been moved to
|
||||
Starting with Spring Framework 4.0 and Spring Integration 4.0, the core Messaging abstraction has been moved to
|
||||
the <emphasis>spring-messaging</emphasis> module and the new <classname>MessageHeaderAccessor</classname> API
|
||||
has been introduced to provide additional abstraction over Messaging implementations. All Spring
|
||||
has been introduced to provide additional abstraction over Messaging implementations. All (core) Spring
|
||||
Integration specific Message Headers constants are now declared in the
|
||||
<classname>IntegrationMessageHeaderAccessor</classname>:
|
||||
<classname>IntegrationMessageHeaderAccessor</classname> class:
|
||||
<table id="integration-message-headers-table">
|
||||
<title>Pre-defined Message Headers</title>
|
||||
<tgroup cols="2">
|
||||
<tgroup cols="3">
|
||||
<colspec align="left" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry align="center">Header Name</entry>
|
||||
<entry align="center">Header Type</entry>
|
||||
<entry align="center">Usage</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>CORRELATION_ID</entry>
|
||||
<entry>java.lang.Object</entry>
|
||||
<entry><code>IntegrationMessageHeaderAccessor.CORRELATION_ID</code></entry>
|
||||
<entry><code>java.lang.Object</code></entry>
|
||||
<entry>Used to correlate two or more messages.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>SEQUENCE_NUMBER</entry>
|
||||
<entry>java.lang.Integer</entry>
|
||||
<entry><code>IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER</code></entry>
|
||||
<entry><code>java.lang.Integer</code></entry>
|
||||
<entry>Usually a sequence number with a group of messages with a
|
||||
<code>SEQUENCE_SIZE</code> but can also
|
||||
be used in a <code><resequencer/> to resequence an unbounded
|
||||
group of messages.</code></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>SEQUENCE_SIZE</entry>
|
||||
<entry>java.lang.Integer</entry>
|
||||
<entry><code>IntegrationMessageHeaderAccessor.SEQUENCE_SIZE</code></entry>
|
||||
<entry><code>java.lang.Integer</code></entry>
|
||||
<entry>The number of messages within a group of correlated messages.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>EXPIRATION_DATE</entry>
|
||||
<entry>java.lang.Long</entry>
|
||||
<entry><code>IntegrationMessageHeaderAccessor.EXPIRATION_DATE</code></entry>
|
||||
<entry><code>java.lang.Long</code></entry>
|
||||
<entry>Indicates when a message is expired. Not used by the framework directly
|
||||
but can be set with a header enricher and used in a <code><filter/></code>
|
||||
configured with an <classname>UnexpiredMessageSelector</classname>.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>PRIORITY</entry>
|
||||
<entry>java.lang.Integer</entry>
|
||||
<entry><code>IntegrationMessageHeaderAccessor.PRIORITY</code></entry>
|
||||
<entry><code>java.lang.Integer</code></entry>
|
||||
<entry>Message priority; for example within a <classname>PriorityChannel</classname></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><code>IntegrationMessageHeaderAccessor.DUPLICATE_MESSAGE</code></entry>
|
||||
<entry><code>java.lang.Boolean</code></entry>
|
||||
<entry>True if a message was detected as a duplicate by an idempotent receiver
|
||||
interceptor. See <xref linkend="idempotent-receiver" />.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
</para>
|
||||
<para>
|
||||
Convenient typed getters for these headers are provided on the
|
||||
Convenient typed getters for some of these headers are provided on the
|
||||
<classname>IntegrationMessageHeaderAccessor</classname> class:
|
||||
<programlisting language="java"><![CDATA[IntegrationMessageHeaderAccessor accessor = new IntegrationMessageHeaderAccessor(message);
|
||||
int sequenceNumber = accessor.getSequenceNumber();
|
||||
Object correlationId = accessor.getCorrelationId();
|
||||
...]]></programlisting>
|
||||
</para>
|
||||
<para>
|
||||
The following headers also appear in the
|
||||
<classname>IntegrationMessageHeaderAccessor</classname> but are generally not used by
|
||||
user code; their inclusion here is for completeness:
|
||||
<table id="extra-integration-message-headers-table">
|
||||
<title>Pre-defined Message Headers</title>
|
||||
<tgroup cols="3">
|
||||
<colspec align="left" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry align="center">Header Name</entry>
|
||||
<entry align="center">Header Type</entry>
|
||||
<entry align="center">Usage</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><code>IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS</code></entry>
|
||||
<entry><code>java.util.List< List<Object>></code></entry>
|
||||
<entry>A stack of correlation data used when nested correlation is needed (e.g. <code>
|
||||
splitter->...->splitter->...->aggregator->...->aggregator</code>).</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><code>IntegrationMessageHeaderAccessor.ROUTING_SLIP</code></entry>
|
||||
<entry><code>java.util.Map< List<Object>, Integer></code></entry>
|
||||
<entry>See <xref linkend="routing-slip" />.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
</para>
|
||||
</section>
|
||||
<section id="message-id-generation">
|
||||
<title>Message ID Generation</title>
|
||||
|
||||
Reference in New Issue
Block a user