Search in sources :

Example 1 with WorkUnit

use of io.automatiko.engine.api.uow.WorkUnit in project automatiko-engine by automatiko-io.

the class CollectingUnitOfWork method end.

@Override
public void end() {
    checkStarted();
    Collection<WorkUnit<?>> units = sorted();
    EventBatch batch = eventManager.newBatch();
    batch.append(units);
    for (WorkUnit<?> work : units) {
        LOGGER.debug("Performing work unit {}", work);
        try {
            work.perform();
        } catch (ConflictingVersionException e) {
            throw e;
        } catch (Exception e) {
            LOGGER.error("Error during performing work unit {} error message {}", work, e.getMessage(), e);
        }
    }
    eventManager.publish(batch);
    done();
}
Also used : ConflictingVersionException(io.automatiko.engine.api.workflow.ConflictingVersionException) WorkUnit(io.automatiko.engine.api.uow.WorkUnit) EventBatch(io.automatiko.engine.api.event.EventBatch) ConflictingVersionException(io.automatiko.engine.api.workflow.ConflictingVersionException)

Aggregations

EventBatch (io.automatiko.engine.api.event.EventBatch)1 WorkUnit (io.automatiko.engine.api.uow.WorkUnit)1 ConflictingVersionException (io.automatiko.engine.api.workflow.ConflictingVersionException)1