GH-1309: Don't Bind Resource When Sync Not Active

Resolves https://github.com/spring-projects/spring-amqp/issues/1309

If the `RabbitTemplate` was called from a `@TransactionalEventListener`,
with phase `AFTER_COMMIT`, a transaction is "active", but synchronizations
are already cleared. It is too late to synchronize this transaction.

We end up with an orphaned `ResourceHolder` with pending transaction commits.

Don't bind the resource holder if synchronization is not active.

However, the proper solution, if users want to synchronize the rabbit transaction
with the global transaction, is to use the `BEFORE_COMMIT` phase.

See the discussion on the Github issue for more information.

**cherry-pick to 2.2.x**

* Fix since version.

* Reset physical close required flag left over from another test.

* Capture test results for all modules.
This commit is contained in:
Gary Russell
2021-03-16 11:26:55 -04:00
committed by GitHub
parent aabf89d2f4
commit b507597f48
4 changed files with 160 additions and 20 deletions

View File

@@ -30,8 +30,9 @@ jobs:
arguments: check
- name: Capture Test Results
if: failure()
uses: actions/upload-artifact@v2
with:
name: test-results
path: spring-rabbit/build/reports/tests
path: '*/build/reports/tests/**/*.*'
retention-days: 3