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);
}
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();
}
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();
}
Aggregations