/** * Initializes an EventSourcedAggregate instance for the given {@code aggregateRoot}, based on the given {@code * inspector}, which publishes events to the given {@code eventBus}. * * @param aggregateRoot The aggregate root instance * @param inspector The inspector describing the aggregate structure * @param eventBus The event bus to send generated events to * @param repositoryProvider Provides repositories for specific aggregate types * @param snapshotTrigger The trigger to notify of events and initialization * @param <T> the aggregate root type * @return the initialized EventSourcedAggregate instance */ public static <T> EventSourcedAggregate<T> initialize(T aggregateRoot, AggregateModel<T> inspector, EventBus eventBus, RepositoryProvider repositoryProvider, SnapshotTrigger snapshotTrigger) { return new EventSourcedAggregate<>(aggregateRoot, inspector, eventBus, repositoryProvider, snapshotTrigger); }
/** * Initializes an EventSourcedAggregate instance using the given {@code aggregateFactory}, based on the given {@code * inspector}, which publishes events to the given {@code eventBus} and stores events in the given {@code * eventStore}. * * @param aggregateFactory The aggregate root factory * @param inspector The inspector describing the aggregate structure * @param eventBus The event bus to send generated events to * @param repositoryProvider Provides repositories for specific aggregate types * @param snapshotTrigger The trigger to notify of events and initialization * @param <T> the aggregate root type * @return the initialized EventSourcedAggregate instance * * @throws Exception if the aggregate cannot be initialized */ public static <T> EventSourcedAggregate<T> initialize(Callable<T> aggregateFactory, AggregateModel<T> inspector, EventBus eventBus, RepositoryProvider repositoryProvider, SnapshotTrigger snapshotTrigger) throws Exception { EventSourcedAggregate<T> aggregate = new EventSourcedAggregate<>(inspector, eventBus, repositoryProvider, snapshotTrigger); aggregate.registerRoot(aggregateFactory); return aggregate; }
/** * Initializes an EventSourcedAggregate instance for the given {@code aggregateRoot}, based on the given {@code * inspector}, which publishes events to the given {@code eventBus}. * * @param aggregateRoot The aggregate root instance * @param inspector The inspector describing the aggregate structure * @param eventBus The event bus to send generated events to * @param repositoryProvider Provides repositories for specific aggregate types * @param snapshotTrigger The trigger to notify of events and initialization * @param <T> the aggregate root type * @return the initialized EventSourcedAggregate instance */ public static <T> EventSourcedAggregate<T> initialize(T aggregateRoot, AggregateModel<T> inspector, EventBus eventBus, RepositoryProvider repositoryProvider, SnapshotTrigger snapshotTrigger) { return new EventSourcedAggregate<>(aggregateRoot, inspector, eventBus, repositoryProvider, snapshotTrigger); }
/** * Initializes an EventSourcedAggregate instance for the given {@code aggregateRoot}, based on the given {@code * inspector}, which publishes events to the given {@code eventBus}. * * @param aggregateRoot The aggregate root instance * @param inspector The inspector describing the aggregate structure * @param eventBus The event bus to send generated events to * @param repositoryProvider Provides repositories for specific aggregate types * @param snapshotTrigger The trigger to notify of events and initialization * @param <T> the aggregate root type * @return the initialized EventSourcedAggregate instance */ public static <T> EventSourcedAggregate<T> initialize(T aggregateRoot, AggregateModel<T> inspector, EventBus eventBus, RepositoryProvider repositoryProvider, SnapshotTrigger snapshotTrigger) { return new EventSourcedAggregate<>(aggregateRoot, inspector, eventBus, repositoryProvider, snapshotTrigger); }
/** * Initializes an EventSourcedAggregate instance using the given {@code aggregateFactory}, based on the given {@code * inspector}, which publishes events to the given {@code eventBus} and stores events in the given {@code * eventStore}. * * @param aggregateFactory The aggregate root factory * @param inspector The inspector describing the aggregate structure * @param eventBus The event bus to send generated events to * @param repositoryProvider Provides repositories for specific aggregate types * @param snapshotTrigger The trigger to notify of events and initialization * @param <T> the aggregate root type * @return the initialized EventSourcedAggregate instance * * @throws Exception if the aggregate cannot be initialized */ public static <T> EventSourcedAggregate<T> initialize(Callable<T> aggregateFactory, AggregateModel<T> inspector, EventBus eventBus, RepositoryProvider repositoryProvider, SnapshotTrigger snapshotTrigger) throws Exception { EventSourcedAggregate<T> aggregate = new EventSourcedAggregate<>(inspector, eventBus, repositoryProvider, snapshotTrigger); aggregate.registerRoot(aggregateFactory); return aggregate; }
/** * Initializes an EventSourcedAggregate instance using the given {@code aggregateFactory}, based on the given {@code * inspector}, which publishes events to the given {@code eventBus} and stores events in the given {@code * eventStore}. * * @param aggregateFactory The aggregate root factory * @param inspector The inspector describing the aggregate structure * @param eventBus The event bus to send generated events to * @param repositoryProvider Provides repositories for specific aggregate types * @param snapshotTrigger The trigger to notify of events and initialization * @param <T> the aggregate root type * @return the initialized EventSourcedAggregate instance * * @throws Exception if the aggregate cannot be initialized */ public static <T> EventSourcedAggregate<T> initialize(Callable<T> aggregateFactory, AggregateModel<T> inspector, EventBus eventBus, RepositoryProvider repositoryProvider, SnapshotTrigger snapshotTrigger) throws Exception { EventSourcedAggregate<T> aggregate = new EventSourcedAggregate<>(inspector, eventBus, repositoryProvider, snapshotTrigger); aggregate.registerRoot(aggregateFactory); return aggregate; }