/** * Apply a {@link DomainEventMessage} with given payload and metadata (metadata from interceptors will be combined * with the provided metadata). Applying events means they are immediately applied (published) to the aggregate and * scheduled for publication to other event handlers. * <p/> * The event is applied on all entities part of this aggregate. If the event is applied from an event handler of the * aggregate and additional events need to be applied that depends on state changes brought about by the first event * use the returned {@link ApplyMore} instance. * * @param payload the payload of the event to apply * @param metaData any meta-data that must be registered with the Event * @return a gizmo to apply additional events after the given event has been processed by the entire aggregate * @see ApplyMore */ public static ApplyMore apply(Object payload, MetaData metaData) { return AggregateLifecycle.getInstance().doApply(payload, metaData); }
/** * Apply a {@link DomainEventMessage} with given payload without metadata (though interceptors can also be used to * provide metadata). Applying events means they are immediately applied (published) to the aggregate and scheduled * for publication to other event handlers. * <p/> * The event is applied on all entities part of this aggregate. If the event is applied from an event handler of the * aggregate and additional events need to be applied that depends on state changes brought about by the first event * use the returned {@link ApplyMore} instance. * * @param payload the payload of the event to apply * @return a gizmo to apply additional events after the given event has been processed by the entire aggregate * @see ApplyMore */ public static ApplyMore apply(Object payload) { return AggregateLifecycle.getInstance().doApply(payload, MetaData.emptyInstance()); }