Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document that @TransactionalEventListener is not supported with ReactiveTransactionManager #23127

Closed
Cepr0 opened this issue Jun 13, 2019 · 7 comments
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) status: duplicate A duplicate of another issue type: documentation A documentation task

Comments

@Cepr0
Copy link

Cepr0 commented Jun 13, 2019

Affects: Spring Boot 2.2.0.M3


If we publish the events within the transactional reactive methods, for example:

@Transactional
public Mono<Model> create(Model model, ModelEvent.Type type) {
    return repo.save(model)
            .doOnSuccess(m -> publisher.publishEvent(new ModelEvent(m, type)));
}

then the 'event listener' method with @TransactionalEventListener is not invoked (regardless of whether the @Async annotation is used or not):

// @Async
@TransactionalEventListener(condition = "#event.inTransactionEventListener()")
public void handleEventInTransactionEventListener(ModelEvent event) {
    log.info("[i] Handled event: {}, in transactional event listener", event.getModel());
}

Related demo is here.

@Cepr0 Cepr0 changed the title @TransactionalEventListener mothod is not invoked while publishing while publishing events within a transactional reactive method @TransactionalEventListener method is not invoked while publishing events within a transactional reactive method Jun 13, 2019
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 13, 2019
@cwiejack
Copy link

cwiejack commented Nov 9, 2020

Hi,
any updates on this issue? I'm having this problem with Spring Boot 2.4.0-RC1

@snicoll
Copy link
Member

snicoll commented Nov 10, 2020

Thanks for the nudge and sorry this wasn't triaged earlier. @TransactionalEvenListener only works with imperative transactions, not reactive transaction so we'll have to clarify that in the reference guide and, potentially, the javadoc of related classes.

@snicoll snicoll added type: documentation A documentation task and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Nov 10, 2020
@snicoll snicoll added this to the 5.x Backlog milestone Nov 10, 2020
@snicoll snicoll changed the title @TransactionalEventListener method is not invoked while publishing events within a transactional reactive method Document that @TransactionalEventListener is not support with ReactiveTransactionManager Nov 10, 2020
@snicoll snicoll changed the title Document that @TransactionalEventListener is not support with ReactiveTransactionManager Document that @TransactionalEventListener is not supported with ReactiveTransactionManager Nov 10, 2020
@cwiejack
Copy link

Hi,
thank you for clarification.

@rstoyanchev rstoyanchev added the in: data Issues in data modules (jdbc, orm, oxm, tx) label Nov 24, 2021
@pkgonan
Copy link

pkgonan commented Jun 15, 2022

@snicoll Hi.
Is there any plan to support TransactionalEventListener for Reactive ? (like @ReactiveTransactionalEventListener).

@snicoll
Copy link
Member

snicoll commented Jun 15, 2022

I am afraid not.

@jhoeller jhoeller modified the milestones: 6.x Backlog, 6.1.x, 6.0.12 Jul 12, 2023
@jhoeller jhoeller self-assigned this Jul 14, 2023
@jhoeller
Copy link
Contributor

As a documentation ticket, this duplicates #25805.

@jhoeller jhoeller added the status: duplicate A duplicate of another issue label Jul 14, 2023
@jhoeller jhoeller removed this from the 6.0.12 milestone Jul 14, 2023
@snicoll snicoll closed this as not planned Won't fix, can't repro, duplicate, stale Jul 14, 2023
@jhoeller jhoeller removed their assignment Jul 15, 2023
@jhoeller
Copy link
Contributor

jhoeller commented Aug 1, 2023

As of 6.1, @TransactionalEventListener can be triggered with reactive transactions through adding the transaction context as the event source: #27515 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) status: duplicate A duplicate of another issue type: documentation A documentation task
Projects
None yet
Development

No branches or pull requests

7 participants