Merge pull request #647 from olegz/INT-2777
This commit is contained in:
@@ -103,11 +103,10 @@ public class SourcePollingChannelAdapter extends AbstractPollingEndpoint impleme
|
||||
IntegrationResourceHolder holder = null;
|
||||
|
||||
if (TransactionSynchronizationManager.isActualTransactionActive()) {
|
||||
holder = new IntegrationResourceHolder();
|
||||
holder.addAttribute(IntegrationResourceHolder.MESSAGE_SOURCE, source);
|
||||
TransactionSynchronizationManager.bindResource(source, holder);
|
||||
|
||||
if (transactionSynchronizationFactory != null){
|
||||
holder = new IntegrationResourceHolder();
|
||||
holder.addAttribute(IntegrationResourceHolder.MESSAGE_SOURCE, source);
|
||||
TransactionSynchronizationManager.bindResource(source, holder);
|
||||
TransactionSynchronizationManager.registerSynchronization(transactionSynchronizationFactory.create(source));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,12 +211,10 @@ public class ImapIdleChannelAdapter extends MessageProducerSupport implements Be
|
||||
MessageBuilder.withPayload(mailMessage).build();
|
||||
|
||||
if (TransactionSynchronizationManager.isActualTransactionActive()) {
|
||||
|
||||
IntegrationResourceHolder holder = new IntegrationResourceHolder();
|
||||
holder.setMessage(message);
|
||||
TransactionSynchronizationManager.bindResource(ImapIdleChannelAdapter.this, holder);
|
||||
|
||||
if (transactionSynchronizationFactory != null){
|
||||
IntegrationResourceHolder holder = new IntegrationResourceHolder();
|
||||
holder.setMessage(message);
|
||||
TransactionSynchronizationManager.bindResource(ImapIdleChannelAdapter.this, holder);
|
||||
TransactionSynchronizationManager.
|
||||
registerSynchronization(transactionSynchronizationFactory.create(ImapIdleChannelAdapter.this));
|
||||
}
|
||||
|
||||
@@ -254,10 +254,20 @@ public interface TransactionSynchronizationProcessor {
|
||||
'payload'.
|
||||
</para>
|
||||
<important>
|
||||
<para>
|
||||
It is important to understand that this is simply synchronizing the actions with a transaction, it does not
|
||||
make a resource that is not inherently transactional actually transactional. Instead, the transaction
|
||||
(be it JDBC or otherwise) is started before the poll, and committed/rolled back when the flow completes,
|
||||
followed by the synchronized action.
|
||||
</para>
|
||||
<para>
|
||||
It is also important to understand that if you provide a custom <classname>TransactionSynchronizationFactory</classname>,
|
||||
it is responsible for creating a resource synchronization that will cause the bound resource to be unbound automatically,
|
||||
when the transaction completes.
|
||||
The default <classname>TransactionSynchronizationFactory</classname> does this by returning a subclass
|
||||
of <classname>ResourceHolderSynchronization</classname>, with the default
|
||||
<emphasis>shouldUnbindAtCompletion()</emphasis> returning <code>true</code>.
|
||||
</para>
|
||||
</important>
|
||||
<para>
|
||||
In addition to the <emphasis>after-commit</emphasis> and <emphasis>after-rollback</emphasis> expressions,
|
||||
|
||||
@@ -119,14 +119,6 @@
|
||||
For more information please see <xref linkend="file-writing-destination-exists"/>.
|
||||
</para>
|
||||
</section>
|
||||
<section id="2.2-tx">
|
||||
<title>Transaction Synchronization</title>
|
||||
<para>
|
||||
When running from a transactional poller,
|
||||
mail inbound adapters can be configured to update the mailbox only
|
||||
if the transaction commits.
|
||||
</para>
|
||||
</section>
|
||||
<section id="2.2-shutdown">
|
||||
<title>Orderly Shutdown</title>
|
||||
<para>
|
||||
|
||||
Reference in New Issue
Block a user