Java Code Examples for javax.enterprise.event.TransactionPhase#AFTER_SUCCESS

The following examples show how to use javax.enterprise.event.TransactionPhase#AFTER_SUCCESS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventImpl.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public static Status valueOf(TransactionPhase transactionPhase) {
    if (transactionPhase == TransactionPhase.BEFORE_COMPLETION
            || transactionPhase == TransactionPhase.AFTER_COMPLETION) {
        return Status.ALL;
    }
    if (transactionPhase == TransactionPhase.AFTER_SUCCESS) {
        return Status.SUCCESS;
    }
    if (transactionPhase == TransactionPhase.AFTER_FAILURE) {
        return Status.FAILURE;
    }
    throw new IllegalArgumentException("Unknown transaction phase " + transactionPhase);
}
 
Example 2
Source File: TransactionalObserversErrorHandlingTest.java    From quarkus with Apache License 2.0 4 votes vote down vote up
public void observeAfterSuccess(@Observes(during = TransactionPhase.AFTER_SUCCESS) String payload) {
    TIMES_NOTIFIED++;
    throw new IllegalStateException("This is an expected exception within test");
}
 
Example 3
Source File: TransactionalObserversErrorHandlingTest.java    From quarkus with Apache License 2.0 4 votes vote down vote up
public void observeAfterSuccess2(@Observes(during = TransactionPhase.AFTER_SUCCESS) String payload) {
    TIMES_NOTIFIED++;
    throw new IllegalStateException("This is an expected exception within test");

}
 
Example 4
Source File: TransactionalObserversTest.java    From quarkus with Apache License 2.0 4 votes vote down vote up
public void observeAfterSuccess(@Observes(during = TransactionPhase.AFTER_SUCCESS) String payload, ReqScopedBean bean) {
    Actions.add(TransactionalObserversTest.AFTER_SUCCESS);
    bean.ping();
}
 
Example 5
Source File: TransactionBoundMessageObserver.java    From cdi-events-playground with MIT License 4 votes vote down vote up
public void observeAfterTransactionCompletion(@Observes(during = TransactionPhase.AFTER_SUCCESS) @Transaction String message) {
    System.out.println("Message from within transaction received after success: " + message);
}
 
Example 6
Source File: ManufacturingStatistics.java    From Architecting-Modern-Java-EE-Applications with MIT License 4 votes vote down vote up
public void carCreated(@Observes(during = TransactionPhase.AFTER_SUCCESS) Specification spec) {
    createdCars.labels(spec.getColor().name(), spec.getEngine().name()).inc();
}
 
Example 7
Source File: AuditLogServiceBean.java    From development with Apache License 2.0 4 votes vote down vote up
public void saveAuditLogEntries(
        @Observes(during = TransactionPhase.AFTER_SUCCESS) AuditLogEntries logData) {
    dao.saveAuditLog(logData.getAuditLogEntries());
}