@Override public CommandBus commandBus() { return config.commandBus(); }
@Override public void start() { registrations.add(commandHandler.get().subscribe(parent.commandBus())); }
/** * Returns a {@link DefaultCommandGateway} that will use the configuration's {@link CommandBus} to dispatch * commands. * * @param config The configuration that supplies the command bus. * @return The default command gateway. */ protected CommandGateway defaultCommandGateway(Configuration config) { return DefaultCommandGateway.builder().commandBus(config.commandBus()).build(); }
@Override public Configurer registerCommandHandler(int phase, Function<Configuration, Object> annotatedCommandHandlerBuilder) { startHandlers.add(new RunnableHandler(phase, () -> { Object handler = annotatedCommandHandlerBuilder.apply(config); Assert.notNull(handler, () -> "annotatedCommandHandler may not be null"); Registration registration = new AnnotationCommandHandlerAdapter(handler, config.parameterResolverFactory(), config.handlerDefinition(handler.getClass())) .subscribe(config.commandBus()); shutdownHandlers.add(new RunnableHandler(phase, registration::cancel)); })); return this; }
aggregate.toString()); if (c.commandBus() instanceof DisruptorCommandBus) { return ((DisruptorCommandBus) c.commandBus()).createRepository(c.eventStore(), aggregateFactory.get(), snapshotTriggerDefinition.get(),
/** * Returns a {@link DefaultCommandGateway} that will use the configuration's {@link CommandBus} to dispatch * commands. * * @param config The configuration that supplies the command bus. * @return The default command gateway. */ protected CommandGateway defaultCommandGateway(Configuration config) { return new DefaultCommandGateway(config.commandBus()); }
@Override public void start() { registrations.add(commandHandler.get().subscribe(parent.commandBus())); }
@Override public void start() { registrations.add(commandHandler.get().subscribe(parent.commandBus())); }
/** * Returns a {@link DefaultCommandGateway} that will use the configuration's {@link CommandBus} to dispatch * commands. * * @param config The configuration that supplies the command bus. * @return The default command gateway. */ protected CommandGateway defaultCommandGateway(Configuration config) { return DefaultCommandGateway.builder().commandBus(config.commandBus()).build(); }
@Override public Configurer registerCommandHandler(int phase, Function<Configuration, Object> annotatedCommandHandlerBuilder) { startHandlers.add(new RunnableHandler(phase, () -> { Object handler = annotatedCommandHandlerBuilder.apply(config); Assert.notNull(handler, () -> "annotatedCommandHandler may not be null"); Registration registration = new AnnotationCommandHandlerAdapter(handler, config.parameterResolverFactory(), config.handlerDefinition(handler.getClass())) .subscribe(config.commandBus()); shutdownHandlers.add(new RunnableHandler(phase, registration::cancel)); })); return this; }
@Override public Configurer registerCommandHandler(int phase, Function<Configuration, Object> annotatedCommandHandlerBuilder) { startHandlers.add(new RunnableHandler(phase, () -> { Object handler = annotatedCommandHandlerBuilder.apply(config); Assert.notNull(handler, () -> "annotatedCommandHandler may not be null"); Registration registration = new AnnotationCommandHandlerAdapter(handler, config.parameterResolverFactory(), config.handlerDefinition(handler.getClass())) .subscribe(config.commandBus()); shutdownHandlers.add(new RunnableHandler(phase, registration::cancel)); })); return this; }
@SneakyThrows public static void disabledMain(String[] args) { final Configuration configuration = DefaultConfigurer.defaultConfiguration() .configureAggregate(Entrance.class) .configureAggregate(Guest.class) .configureEmbeddedEventStore(c -> new InMemoryEventStorageEngine()) .configureCommandBus(c -> new AsynchronousCommandBus()) .buildConfiguration(); configuration.start(); final CommandBus commandBus = configuration.commandBus(); commandBus.dispatch(asCommandMessage(new RegisterEntranceCommand("main"))); commandBus.dispatch(asCommandMessage(new UnlockEntranceCommand("main"))); commandBus.dispatch(asCommandMessage(new UnregisterEntranceCommand("main")) ); TimeUnit.SECONDS.sleep(1L); } }
"Store to use, or configure a specific repository implementation for " + aggregate.toString()); if (c.commandBus() instanceof DisruptorCommandBus) { return ((DisruptorCommandBus) c.commandBus()).createRepository(c.eventStore(), aggregateFactory.get(), snapshotTriggerDefinition.get(),
aggregate.toString()); if (c.commandBus() instanceof DisruptorCommandBus) { return ((DisruptorCommandBus) c.commandBus()).createRepository(c.eventStore(), aggregateFactory.get(), snapshotTriggerDefinition.get(),