post commit action (UnitOfWork)

39 views
Skip to first unread message

yateam

unread,
Jul 19, 2017, 2:41:38 AM7/19/17
to dropwizard-user
Hello, 

is there any way to schedule some action after UnitOfWork commit is done? 
For example, I want to send an email only if the transaction is successful. How would I do it if a Jersey resource is wrapped with @UnitOfWork?
I could think of a workaround, where you put events in some sort of an EventBus, and if a request transaction is successful, then those events would execute. But maybe you experienced something like that and know best practices applicable to Dropwizard?

Thanks!

Alex Kudlick

unread,
Sep 8, 2021, 7:41:09 PM9/8/21
to dropwizard-user
Hi, you can call the addEventListeners method of the hibernate session to register a listener for the current transaction.
Reply all
Reply to author
Forward
0 new messages