Search in sources :

Example 1 with EventOperation

use of io.spine.server.tenant.EventOperation in project core-java by SpineEventEngine.

the class EventStore method append.

/**
     * Appends the passed event to the history of events.
     *
     * @param event the record to append
     */
public void append(final Event event) {
    final TenantAwareOperation op = new EventOperation(event) {

        @Override
        public void run() {
            store(event);
        }
    };
    op.execute();
    logStored(event);
}
Also used : EventOperation(io.spine.server.tenant.EventOperation) TenantAwareOperation(io.spine.server.tenant.TenantAwareOperation)

Example 2 with EventOperation

use of io.spine.server.tenant.EventOperation in project core-java by SpineEventEngine.

the class EventDispatchingRepository method dispatch.

/**
     * Dispatches the passed event envelope to entities.
     *
     * @param envelope the event envelope to dispatch
     */
@Override
public void dispatch(EventEnvelope envelope) {
    final Message eventMessage = envelope.getMessage();
    final EventContext context = envelope.getEventContext();
    final Set<I> ids = findIds(eventMessage, context);
    final EventOperation op = new EventOperation(envelope.getOuterObject()) {

        @Override
        public void run() {
            for (I id : ids) {
                dispatchToEntity(id, eventMessage, context);
            }
        }
    };
    op.execute();
}
Also used : EventContext(io.spine.base.EventContext) Message(com.google.protobuf.Message) EventOperation(io.spine.server.tenant.EventOperation)

Example 3 with EventOperation

use of io.spine.server.tenant.EventOperation in project core-java by SpineEventEngine.

the class EventSubscriber method dispatch.

@Override
public void dispatch(final EventEnvelope envelope) {
    final EventOperation op = new EventOperation(envelope.getOuterObject()) {

        @Override
        public void run() {
            handle(envelope.getMessage(), envelope.getEventContext());
        }
    };
    op.execute();
}
Also used : EventOperation(io.spine.server.tenant.EventOperation)

Aggregations

EventOperation (io.spine.server.tenant.EventOperation)3 Message (com.google.protobuf.Message)1 EventContext (io.spine.base.EventContext)1 TenantAwareOperation (io.spine.server.tenant.TenantAwareOperation)1