INT-2215 - Refactor Claim Check Schema Definition

This commit is contained in:
Gunnar Hillert
2011-11-01 18:15:23 -04:00
committed by Mark Fisher
parent aef0f4780e
commit fa606de097
2 changed files with 263 additions and 60 deletions

View File

@@ -24,22 +24,33 @@
</para>
<para>
Spring Integration provides two types of Claim Check transformers: <emphasis>Incoming Claim Check Transformer</emphasis> and
<emphasis>Outgoing Claim Check Transformer</emphasis>. Convenient namespace-based mechanisms are available to configure them.
Spring Integration provides two types of Claim Check transformers:
</para>
<itemizedlist>
<listitem><emphasis>Incoming Claim Check Transformer</emphasis></listitem>
<listitem><emphasis>Outgoing Claim Check Transformer</emphasis></listitem>
</itemizedlist>
<para>
Convenient namespace-based mechanisms are available to configure them.
</para>
</section>
<section id="claim-check-in">
<title>Incoming Claim Check Transformer</title>
<para>
An <emphasis>Incoming Claim Check Transformer</emphasis> will transform an incoming Message by storing it in the Message Store
identified by its <code>message-store</code> attribute.
An <emphasis>Incoming Claim Check Transformer</emphasis> will transform an incoming Message by storing it in the Message Store
identified by its <code>message-store</code> attribute.
</para>
<programlisting language="xml"><![CDATA[<int:claim-check-in id="checkin"
input-channel="checkinChannel"
message-store="testMessageStore"
output-channel="output"/>]]></programlisting>
<para>
In the above configuration the Message that is received on the <code>input-channel</code> will be persisted to the
Message Store identified with the <code>message-store</code> attribute and indexed with generated ID. That ID is the
Claim Check for that Message.
@@ -51,6 +62,73 @@
manually and get the contents of the Message, or you can use the same approach as before except now you will be transforming
the Claim Check to the actual Message by using an <emphasis>Outgoing Claim Check Transformer</emphasis>.
</para>
<para>
Here is an overview of all available parameters of an Incoming Claim
Check Transformer:
</para>
<programlisting language="xml"><![CDATA[<int:claim-check-in auto-startup="true" ]]><co id="claimcheck-in-xml01-co" linkends="claimcheck-in-xml01" /><![CDATA[
id="" ]]><co id="claimcheck-in-xml02-co" linkends="claimcheck-in-xml02" /><![CDATA[
input-channel="" ]]><co id="claimcheck-in-xml03-co" linkends="claimcheck-in-xml03" /><![CDATA[
message-store="messageStore" ]]><co id="claimcheck-in-xml04-co" linkends="claimcheck-in-xml04" /><![CDATA[
order="" ]]><co id="claimcheck-in-xml05-co" linkends="claimcheck-in-xml05" /><![CDATA[
output-channel="" ]]><co id="claimcheck-in-xml06-co" linkends="claimcheck-in-xml06" /><![CDATA[
send-timeout=""> ]]><co id="claimcheck-in-xml07-co" linkends="claimcheck-in-xml07" /><![CDATA[
<int:poller></int:poller> ]]><co id="claimcheck-in-xml08-co" linkends="claimcheck-in-xml08" /><![CDATA[
</int:claim-check-in>]]></programlisting>
<para>
<calloutlist>
<callout arearefs="claimcheck-in-xml01-co" id="claimcheck-in-xml01">
<para>Lifecycle attribute signaling if this component should
be started during Application Context startup. Defaults
to true. Attribute is not available inside a <code>Chain</code> element.
<emphasis>Optional</emphasis>.</para>
</callout>
<callout arearefs="claimcheck-in-xml02-co" id="claimcheck-in-xml02">
<para>Id identifying the underlying bean definition (<classname>MessageTransformingHandler</classname>).
Attribute is not available inside a <code>Chain</code> element.
<emphasis>Optional</emphasis>.</para>
</callout>
<callout arearefs="claimcheck-in-xml03-co" id="claimcheck-in-xml03">
<para>The receiving Message channel of this endpoint.
Attribute is not available inside a <code>Chain</code> element.
<emphasis>Optional</emphasis>.</para>
</callout>
<callout arearefs="claimcheck-in-xml04-co" id="claimcheck-in-xml04">
<para>Reference to the MessageStore to be used by this Claim
Check transformer. If not specified, the default reference
will be to a bean named <emphasis>messageStore</emphasis>.
<emphasis>Optional</emphasis>.</para>
</callout>
<callout arearefs="claimcheck-in-xml05-co" id="claimcheck-in-xml05">
<para>Specifies the order for invocation when this endpoint is
connected as a subscriber to a channel. This is particularly
relevant when that channel is using a <emphasis>failover</emphasis>
dispatching strategy. It has no effect when this endpoint
itself is a Polling Consumer for a channel with a queue.
Attribute is not available inside a <code>Chain</code> element.
<emphasis>Optional</emphasis>.</para>
</callout>
<callout arearefs="claimcheck-in-xml06-co" id="claimcheck-in-xml06">
<para>Identifies the Message channel where Message will be sent
after its being processed by this endpoint.
Attribute is not available inside a <code>Chain</code> element.
<emphasis>Optional</emphasis>.</para>
</callout>
<callout arearefs="claimcheck-in-xml07-co" id="claimcheck-in-xml07">
<para>Specify the maximum amount of time in milliseconds to wait
when sending a reply Message to the output channel. By default
the send will block for one second.
Attribute is not available inside a <code>Chain</code> element.
<emphasis>Optional</emphasis>.</para>
</callout>
<callout arearefs="claimcheck-in-xml08-co" id="claimcheck-in-xml08">
<para>Defines a poller. Element is not available inside
a <code>Chain</code> element.
<emphasis>Optional</emphasis>.</para>
</callout>
</calloutlist>
</para>
</section>
<section id="claim-check-out">
@@ -59,16 +137,96 @@
<para>
An <emphasis>Outgoing Claim Check Transformer</emphasis> allows you to transform a Message with a Claim Check payload
into a Message with the original content as its payload.
</para>
<programlisting language="xml"><![CDATA[<int:claim-check-out id="checkout"
input-channel="checkoutChannel"
message-store="testMessageStore"
output-channel="output"/>]]></programlisting>
<para>
In the above configuration, the Message that is received on the <code>input-channel</code> should have a Claim Check as its payload
and the <emphasis>Outgoing Claim Check Transformer</emphasis> will transform it into a Message with the original payload by simply
querying the Message store for a Message identified by the provided Claim Check. It then sends the newly checked-out Message to the
<code>output-channel</code>.
</para>
<para>
Here is an overview of all available parameters of an Outgoing Claim
Check Transformer:
</para>
<programlisting language="xml"><![CDATA[<int:claim-check-out auto-startup="true" ]]><co id="claimcheck-out-xml01-co" linkends="claimcheck-out-xml01" /><![CDATA[
id="" ]]><co id="claimcheck-out-xml02-co" linkends="claimcheck-out-xml02" /><![CDATA[
input-channel="" ]]><co id="claimcheck-out-xml03-co" linkends="claimcheck-out-xml03" /><![CDATA[
message-store="messageStore" ]]><co id="claimcheck-out-xml04-co" linkends="claimcheck-out-xml04" /><![CDATA[
order="" ]]><co id="claimcheck-out-xml05-co" linkends="claimcheck-out-xml05" /><![CDATA[
output-channel="" ]]><co id="claimcheck-out-xml06-co" linkends="claimcheck-out-xml06" /><![CDATA[
remove-message="false" ]]><co id="claimcheck-out-xml07-co" linkends="claimcheck-out-xml07" /><![CDATA[
send-timeout=""> ]]><co id="claimcheck-out-xml08-co" linkends="claimcheck-out-xml08" /><![CDATA[
<int:poller></int:poller> ]]><co id="claimcheck-out-xml09-co" linkends="claimcheck-out-xml09" /><![CDATA[
</int:claim-check-out>]]></programlisting>
<para>
<calloutlist>
<callout arearefs="claimcheck-out-xml01-co" id="claimcheck-out-xml01">
<para>Lifecycle attribute signaling if this component should
be started during Application Context startup. Defaults
to true. Attribute is not available inside a <code>Chain</code> element.
<emphasis>Optional</emphasis>.</para>
</callout>
<callout arearefs="claimcheck-out-xml02-co" id="claimcheck-out-xml02">
<para>Id identifying the underlying bean definition (<classname>MessageTransformingHandler</classname>).
Attribute is not available inside a <code>Chain</code> element.
<emphasis>Optional</emphasis>.</para>
</callout>
<callout arearefs="claimcheck-out-xml03-co" id="claimcheck-out-xml03">
<para>The receiving Message channel of this endpoint.
Attribute is not available inside a <code>Chain</code> element.
<emphasis>Optional</emphasis>.</para>
</callout>
<callout arearefs="claimcheck-out-xml04-co" id="claimcheck-out-xml04">
<para>Reference to the MessageStore to be used by this Claim
Check transformer. If not specified, the default reference
will be to a bean named <emphasis>messageStore</emphasis>.
<emphasis>Optional</emphasis>.</para>
</callout>
<callout arearefs="claimcheck-out-xml05-co" id="claimcheck-out-xml05">
<para>Specifies the order for invocation when this endpoint is
connected as a subscriber to a channel. This is particularly
relevant when that channel is using a <emphasis>failover</emphasis>
dispatching strategy. It has no effect when this endpoint
itself is a Polling Consumer for a channel with a queue.
Attribute is not available inside a <code>Chain</code> element.
<emphasis>Optional</emphasis>.</para>
</callout>
<callout arearefs="claimcheck-out-xml06-co" id="claimcheck-out-xml06">
<para>Identifies the Message channel where Message will be sent
after its being processed by this endpoint.
Attribute is not available inside a <code>Chain</code> element.
<emphasis>Optional</emphasis>.</para>
</callout>
<callout arearefs="claimcheck-out-xml07-co" id="claimcheck-out-xml07">
<para>If set to <code>true</code> the Message will be removed from the
MessageStore by this transformer. Useful when Message can
be "claimed" only once. Defaults to <code>false</code>.
<emphasis>Optional</emphasis>.</para>
</callout>
<callout arearefs="claimcheck-out-xml08-co" id="claimcheck-out-xml08">
<para>Specify the maximum amount of time in milliseconds to wait
when sending a reply Message to the output channel. By default
the send will block for one second.
Attribute is not available inside a <code>Chain</code> element.
<emphasis>Optional</emphasis>.</para>
</callout>
<callout arearefs="claimcheck-out-xml09-co" id="claimcheck-out-xml09">
<para>Defines a poller. Element is not available inside
a <code>Chain</code> element.
<emphasis>Optional</emphasis>.</para>
</callout>
</calloutlist>
</para>
<para><emphasis>Claim Once</emphasis></para>
<para>
There are scenarios when a particular message must be claimed only once. As an analogy, consider the airplane luggage check-in/out process.
@@ -91,20 +249,17 @@
output-channel="output"
remove-message="true"/>]]></programlisting>
</section>
<para>
Although we rarely care about the details of the claim checks as long as they work, it is still worth knowing that
the current implementation of the actual Claim Check (the pointer) in Spring Integration is a UUID to ensure uniqueness.
</para>
<para>
<emphasis>A word on Message Store</emphasis>
</para>
<para>
<classname>org.springframework.integration.store.MessageStore</classname> is a strategy interface for storing and retrieving messages.
Spring Integration provides two convenient implementations of it. <classname>SimpleMessageStore</classname>: an in-memory, Map-based
implementation (the default, good for testing) and <classname>JdbcMessageStore</classname>: an implementation that uses a relational
database via JDBC.
</para>
</section>
<section>
<title>A word on Message Store</title>
<para>
Although we rarely care about the details of the claim checks as long as they work, it is still worth knowing that
the current implementation of the actual Claim Check (the pointer) in Spring Integration is a UUID to ensure uniqueness.
</para>
<para>
<classname>org.springframework.integration.store.MessageStore</classname> is a strategy interface for storing and retrieving messages.
Spring Integration provides two convenient implementations of it. <classname>SimpleMessageStore</classname>: an in-memory, Map-based
implementation (the default, good for testing) and <classname>JdbcMessageStore</classname>: an implementation that uses a relational
database via JDBC.
</para>
</section>
</section>

View File

@@ -1235,8 +1235,8 @@ endpoint itself is a Polling Consumer for a channel with a queue.
<xsd:element name="map-to-object-transformer" type="map-to-object-transformer-type" />
<xsd:element name="object-to-json-transformer" type="object-to-json-transformer-type" />
<xsd:element name="json-to-object-transformer" type="json-to-object-transformer-type" />
<xsd:element name="claim-check-in" type="claimCheckTransformerType" />
<xsd:element name="claim-check-out" type="claimCheckTransformerType" />
<xsd:element name="claim-check-in" type="claimCheckInTypeChain" />
<xsd:element name="claim-check-out" type="claimCheckOutTypeChain" />
<xsd:element name="control-bus" type="control-bus-type" />
<xsd:element name="chain" type="chain-type" />
</xsd:choice>
@@ -1969,51 +1969,96 @@ endpoint itself is a Polling Consumer for a channel with a queue.
</xsd:attribute>
</xsd:complexType>
<xsd:element name="claim-check-in" type="claimCheckTransformerType">
<!-- Claim Check -->
<xsd:element name="claim-check-in" type="claimCheckInType">
<xsd:annotation>
<xsd:documentation>
Defines a Transformer that stores a Message and returns a new Message whose
payload is the id of
the stored Message.
Defines a Transformer that stores a Message and returns a new
Message, whose payload is the id of the stored Message.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="claim-check-out">
<xsd:complexType name="claimCheckInType">
<xsd:complexContent>
<xsd:extension base="commonClaimCheckType">
<xsd:sequence minOccurs="0" maxOccurs="1">
<xsd:element ref="poller" />
</xsd:sequence>
<xsd:attributeGroup ref="inputOutputChannelGroup" />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="claimCheckInTypeChain">
<xsd:complexContent>
<xsd:extension base="commonClaimCheckType">
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="claim-check-out" type="claimCheckOutType">
<xsd:annotation>
<xsd:documentation>
Defines a Transformer that accepts a Message whose payload is a UUID and
retrieves the Message
associated with that id from a MessageStore if
available (else null).
Defines a Transformer that accepts a Message whose payload is a
UUID and retrieves the Message associated with that id from a
MessageStore if available (else null).
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="claimCheckTransformerType">
<xsd:attribute name="remove-message" type="xsd:boolean" default="false">
<xsd:annotation>
<xsd:documentation>
If set to 'true' the Message will be removed from the MessageStore by
this transformer. Useful when Message can be 'claimed' only once. DEFAULT is 'false'.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="claimCheckTransformerType">
<xsd:sequence minOccurs="0" maxOccurs="1">
<xsd:element ref="poller" />
</xsd:sequence>
<xsd:complexType name="claimCheckOutType">
<xsd:complexContent>
<xsd:extension base="commonClaimCheckType">
<xsd:sequence minOccurs="0" maxOccurs="1">
<xsd:element ref="poller" />
</xsd:sequence>
<xsd:attribute name="remove-message" default="false">
<xsd:annotation>
<xsd:documentation>
If set to 'true' the Message will be removed
from the MessageStore by this transformer.
Useful when the Message can be 'claimed' only
once. DEFAULT is 'false'.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:union memberTypes="xsd:boolean xsd:string" />
</xsd:simpleType>
</xsd:attribute>
<xsd:attributeGroup ref="inputOutputChannelGroup" />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="claimCheckOutTypeChain">
<xsd:complexContent>
<xsd:extension base="commonClaimCheckType">
<xsd:attribute name="remove-message" default="false">
<xsd:annotation>
<xsd:documentation>
If set to 'true' the Message will be removed
from the MessageStore by this transformer.
Useful when Message can be 'claimed' only
once. DEFAULT is 'false'.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:union memberTypes="xsd:boolean xsd:string" />
</xsd:simpleType>
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="commonClaimCheckType">
<xsd:attribute name="message-store" default="messageStore">
<xsd:annotation>
<xsd:documentation>
Reference to the MessageStore to be used by this Claim Check transformer.
If not specified, the
default reference will be to a bean named 'messageStore'.
Reference to the MessageStore to be used by this Claim Check
transformer. If not specified, the default reference will be
to a bean named 'messageStore'.
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
@@ -2022,7 +2067,6 @@ endpoint itself is a Polling Consumer for a channel with a queue.
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attributeGroup ref="inputOutputChannelGroup" />
</xsd:complexType>
<xsd:complexType name="specialized-transformer-type">
@@ -3423,12 +3467,16 @@ endpoint itself is a Polling Consumer for a channel with a queue.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="auto-startup" type="xsd:string" >
<xsd:annotation>
<xsd:documentation>
Lifecycle attribute signaling if this component should be started during Application Context startup.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="auto-startup" default="true">
<xsd:annotation>
<xsd:documentation>
Lifecycle attribute signaling if this component should be
started during Application Context startup. Defaults to true.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:union memberTypes="xsd:boolean xsd:string" />
</xsd:simpleType>
</xsd:attribute>
</xsd:attributeGroup>
</xsd:schema>