CDI spec allows you to specify that a particular observer should receive event notifications during the before or after completion phase of the transaction in which the event was raised. I.e. it defers the notifications of an event until the intended phase of the transaction has been reached (as opposed to the current implementation that only allows immediate notifications).
Ref: https://docs.jboss.org/weld/reference/latest/en-US/html/events.html#_transactional_observers
Supported options are:
IN_PROGRESS
AFTER_SUCCESS
AFTER_FAILURE
AFTER_COMPLETION
BEFORE_COMPLETION
Example
public void OnLoggedIn([Observes(During=TransactionPhase.AfterSuccess)] LoggedIn evt)
{
/* handles */
}
This is important e.g. in scenario where you want to send an outbound customer email only after the transaction has been successfully committed.
Expanding on https://github.com/hendryluk/cormo/issues/7
CDI spec allows you to specify that a particular observer should receive event notifications during the before or after completion phase of the transaction in which the event was raised. I.e. it defers the notifications of an event until the intended phase of the transaction has been reached (as opposed to the current implementation that only allows immediate notifications). Ref: https://docs.jboss.org/weld/reference/latest/en-US/html/events.html#_transactional_observers
Supported options are:
Example
This is important e.g. in scenario where you want to send an outbound customer email only after the transaction has been successfully committed.