GH-8582: Add TX support for PostgresSubChannel

Fixes https://github.com/spring-projects/spring-integration/issues/8582

* Introduce a `PostgresSubscribableChannel.setTransactionManager()`
to wrap a message polling and dispatching operation into a transaction
* In addition add a `RetryTemplate` support around transaction attempts

**Cherry-pick to `6.0.x`**
This commit is contained in:
Igor Lovich
2023-03-28 09:31:15 +02:00
committed by abilan
parent b326225df7
commit e39449b643
4 changed files with 215 additions and 50 deletions

View File

@@ -621,6 +621,18 @@ public PostgresSubscribableChannel channel(
return new PostgresSubscribableChannel(messageStore, "some group", subscriber);
}
----
*Transaction support*
Starting with version 6.0.5, specifying a `PlatformTransactionManager` on a `PostgresSubscribableChannel` will notify subscribers in a transaction.
An exception in a subscriber will cause the transaction to be rolled back and the message to be put back in the message store.
Transactional support is not activated by default.
*Retries*
Starting with version 6.0.5, a retry policy can be specified by providing a `RetryTemplate` to the `PostgresSubscribableChannel`.
By default, no retries are performed.
====
[IMPORTANT]
@@ -632,6 +644,7 @@ Such connection pools do normally expect that issued connections are closed with
For this need of an exclusive connection, it is also recommended that a JVM only runs a single `PostgresChannelMessageTableSubscriber` which can be used to register any number of subscriptions.
====
[[stored-procedures]]
=== Stored Procedures