@Override public void start() { registrations.add(commandHandler.get().subscribe(parent.commandBus())); }
private void registerAggregateCommandHandlers() { ensureRepositoryConfiguration(); if (!explicitCommandHandlersSet) { AggregateAnnotationCommandHandler.Builder<T> builder = AggregateAnnotationCommandHandler.<T>builder() .aggregateType(aggregateType) .parameterResolverFactory(parameterResolverFactory) .repository(this.repository); if (commandTargetResolver != null) { builder.commandTargetResolver(commandTargetResolver); } AggregateAnnotationCommandHandler<T> handler = builder.build(); handler.subscribe(commandBus); } }
@SuppressWarnings("unchecked") @Before public void setUp() { eventStore = spy(EmbeddedEventStore.builder().storageEngine(new InMemoryEventStorageEngine()).build()); Repository<MyAggregate> myAggregateRepository = EventSourcingRepository.builder(MyAggregate.class) .eventStore(eventStore) .build(); CommandBus commandBus = SimpleCommandBus.builder().build(); commandGateway = DefaultCommandGateway.builder().commandBus(commandBus).build(); AggregateAnnotationCommandHandler<MyAggregate> myAggregateCommandHandler = AggregateAnnotationCommandHandler.<MyAggregate>builder() .aggregateType(MyAggregate.class) .repository(myAggregateRepository) .build(); myAggregateCommandHandler.subscribe(commandBus); }
@Override public void start() { registrations.add(commandHandler.get().subscribe(parent.commandBus())); }