INT-2722: Document Delayer's <advice-chain>
* describe delayer's `<transactional>` & `<advice-chain>` abilities * polishing delayer's doc: it looks bad in the PDF * fix typo for 'proxying' JIRA: https://jira.springsource.org/browse/INT-2722 INT-2722: Polishing - PR comments
This commit is contained in:
committed by
Gary Russell
parent
0345a381b2
commit
600a347652
@@ -1302,7 +1302,7 @@
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
'transactional' and 'advice-chain' elements specify the configuration List of AOP Advice
|
||||
to proxying DelayHandler's 'release Message task'.
|
||||
to proxy DelayHandler's 'release Message task'.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:element name="transactional" type="transactionalType" minOccurs="0" maxOccurs="1" />
|
||||
@@ -3783,14 +3783,14 @@ endpoint itself is a Polling Consumer for a channel with a queue.
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:attributeGroup>
|
||||
|
||||
|
||||
<xsd:attributeGroup name="transactionSyncAttributeGroup">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Attributes provided in either a <transactional/> or <psedo-transactional/> poller
|
||||
sub element.
|
||||
Used to take action after the transaction completes (<transactional/>) or after
|
||||
the channel.send() is complete (<pseudo-transactional/>).
|
||||
the channel.send() is complete (<pseudo-transactional/>).
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="on-success-expression">
|
||||
@@ -3798,7 +3798,7 @@ endpoint itself is a Polling Consumer for a channel with a queue.
|
||||
<xsd:documentation><![CDATA[
|
||||
Expression to be evaluated when no exception is thrown (<pseudo-transactional/>),
|
||||
or after the transaction commits (<transactional/>). The #root variable of the
|
||||
expression evaluation is the original message; a BeanResolver is also available.
|
||||
expression evaluation is the original message; a BeanResolver is also available.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
@@ -3822,7 +3822,7 @@ endpoint itself is a Polling Consumer for a channel with a queue.
|
||||
<xsd:documentation><![CDATA[
|
||||
Expression to be evaluated when an exception is thrown (<pseudo-transactional/>),
|
||||
or after the transaction rolls back (<transactional/>). The #root variable of the
|
||||
expression evaluation is the original message; a BeanResolver is also available.
|
||||
expression evaluation is the original message; a BeanResolver is also available.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
delay-header-name="delay"
|
||||
scheduler="exampleTaskScheduler"/>
|
||||
|
||||
<task:scheduler id="exampleTaskScheduler" pool-size="3"/>]]></programlisting>
|
||||
<task:scheduler id="exampleTaskScheduler" pool-size="3"/>]]></programlisting>
|
||||
<tip>
|
||||
If you configure an external <classname>ThreadPoolTaskScheduler</classname>
|
||||
you can set on this scheduler property <code>waitForTasksToCompleteOnShutdown = true</code>.
|
||||
@@ -95,14 +95,37 @@
|
||||
If a delayed Message remained in the <interfacename>MessageStore</interfacename> more
|
||||
than its 'delay', it will be sent immediately after startup.
|
||||
</para>
|
||||
<para>
|
||||
The <code><delayer></code> can be enriched with mutually exclusive sub-elements <code><transactional></code>
|
||||
or <code><advice-chain></code>. The List of these AOP Advices is applied to the proxied internal
|
||||
<classname>DelayHandler.ReleaseMessageHandler</classname>, which has the responsibility to release the Message, after the delay,
|
||||
on a <classname>Thread</classname> of the scheduled task. It might be used, for example, when the downstream message flow throws an
|
||||
Exception and the <classname>ReleaseMessageHandler</classname>'s transaction will be rolled back. In this case the delayed
|
||||
Message will remain in the persistent <interfacename>MessageStore</interfacename>. You can use any custom
|
||||
<interfacename>org.aopalliance.aop.Advice</interfacename> implementation within the <code><advice-chain></code>.
|
||||
A sample configuration of the <code><delayer></code> may look like this:
|
||||
<programlisting language="xml"><![CDATA[ <int:delayer id="delayer" input-channel="input" output-channel="output"
|
||||
delay-header-name="delay"
|
||||
message-store="jdbcMessageStore">
|
||||
<int:advice-chain>
|
||||
<beans:ref bean="customAdviceBean"/>
|
||||
<tx:advice>
|
||||
<tx:attributes>
|
||||
<tx:method name="*" read-only="true"/>
|
||||
</tx:attributes>
|
||||
</tx:advice>
|
||||
</int:advice-chain>
|
||||
</int:delayer>]]></programlisting>
|
||||
</para>
|
||||
<para>
|
||||
The <classname>DelayHandler</classname> can be exported as a JMX <code>MBean</code>
|
||||
with managed operations <code>getDelayedMessageCount</code> and <code>reschedulePersistedMessages</code>,
|
||||
which allows the rescheduling of delayed persisted Messages at runtime, for example, if the
|
||||
<interfacename>TaskScheduler</interfacename> has previously been stopped. These operations can be invoked via a <code>Control Bus</code> command:
|
||||
<programlisting language="java"><![CDATA[
|
||||
Message<String> delayerReschedulingMessage = MessageBuilder.withPayload("@'delayer.handler'.reschedulePersistedMessages()").build();
|
||||
controlBusChannel.send(delayerReschedulingMessage);]]></programlisting>
|
||||
<interfacename>TaskScheduler</interfacename> has previously been stopped.
|
||||
These operations can be invoked via a <code>Control Bus</code> command:
|
||||
<programlisting language="java"><![CDATA[ Message<String> delayerReschedulingMessage =
|
||||
MessageBuilder.withPayload("@'delayer.handler'.reschedulePersistedMessages()").build();
|
||||
controlBusChannel.send(delayerReschedulingMessage);]]></programlisting>
|
||||
</para>
|
||||
<note>
|
||||
For more information regarding the Message Store, JMX and the Control Bus, please read <xref linkend="system-management-chapter"/>.
|
||||
|
||||
Reference in New Issue
Block a user