/** * Registers a handler to be executed when the Configuration is shut down. * <p> * The behavior for handlers that are registered when the Configuration is already shut down is undefined. * * @param shutdownHandler The handler to execute when the Configuration is shut down * @see #shutdown() * @see #onStart(Runnable) */ default void onShutdown(Runnable shutdownHandler) { onShutdown(0, shutdownHandler); }
@Override public void onShutdown(int phase, Runnable shutdownHandler) { config.onShutdown(phase, shutdownHandler); }
private AxonServerConnectionManager buildAxonServerConnectionManager(Configuration c) { AxonServerConnectionManager axonServerConnectionManager = new AxonServerConnectionManager(c.getComponent( AxonServerConfiguration.class)); c.onShutdown(axonServerConnectionManager::shutdown); return axonServerConnectionManager; }
@Override public Configurer configureEmbeddedEventStore(Function<Configuration, EventStorageEngine> storageEngineBuilder) { return configureEventStore(c -> { MessageMonitor<Message<?>> monitor = messageMonitorFactoryComponent.get().apply(EmbeddedEventStore.class, "eventStore"); EmbeddedEventStore eventStore = EmbeddedEventStore.builder() .storageEngine(storageEngineBuilder.apply(c)) .messageMonitor(monitor) .build(); c.onShutdown(eventStore::shutDown); return eventStore; }); }
private AxonServerCommandBus buildCommandBus(Configuration c) { AxonServerCommandBus commandBus = new AxonServerCommandBus(c.getComponent(AxonServerConnectionManager.class), c.getComponent(AxonServerConfiguration.class), SimpleCommandBus.builder().build(), c.messageSerializer(), c.getComponent(RoutingStrategy.class, AnnotationRoutingStrategy::new), c.getComponent(CommandPriorityCalculator.class, () -> new CommandPriorityCalculator() {})); c.onShutdown(commandBus::disconnect); return commandBus; }
private QueryBus buildQueryBus(Configuration c) { SimpleQueryBus localSegment = SimpleQueryBus.builder() .transactionManager(c.getComponent(TransactionManager.class, NoTransactionManager::instance)) .errorHandler(c.getComponent(QueryInvocationErrorHandler.class, () -> LoggingQueryInvocationErrorHandler.builder().build())) .queryUpdateEmitter(c.queryUpdateEmitter()) .messageMonitor(c.messageMonitor(QueryBus.class, "localQueryBus")) .build(); AxonServerQueryBus queryBus = new AxonServerQueryBus(c.getComponent(AxonServerConnectionManager.class), c.getComponent(AxonServerConfiguration.class), c.queryUpdateEmitter(), localSegment, c.messageSerializer(), c.serializer(), c.getComponent(QueryPriorityCalculator.class, () -> new QueryPriorityCalculator() {})); c.onShutdown(queryBus::disconnect); return queryBus; }
/** * Registers a handler to be executed when the Configuration is shut down. * <p> * The behavior for handlers that are registered when the Configuration is already shut down is undefined. * * @param shutdownHandler The handler to execute when the Configuration is shut down * @see #shutdown() * @see #onStart(Runnable) */ default void onShutdown(Runnable shutdownHandler) { onShutdown(0, shutdownHandler); }
/** * Registers a handler to be executed when the Configuration is shut down. * <p> * The behavior for handlers that are registered when the Configuration is already shut down is undefined. * * @param shutdownHandler The handler to execute when the Configuration is shut down * @see #shutdown() * @see #onStart(Runnable) */ default void onShutdown(Runnable shutdownHandler) { onShutdown(0, shutdownHandler); }
@Override public Configurer configureEmbeddedEventStore(Function<Configuration, EventStorageEngine> storageEngineBuilder) { return configureEventStore(c -> { MessageMonitor<Message<?>> monitor = messageMonitorFactoryComponent.get().apply(EmbeddedEventStore.class, "eventStore"); EmbeddedEventStore eventStore = new EmbeddedEventStore(storageEngineBuilder.apply(c), monitor); c.onShutdown(eventStore::shutDown); return eventStore; }); }
private AxonServerConnectionManager buildAxonServerConnectionManager(Configuration c) { AxonServerConnectionManager axonServerConnectionManager = new AxonServerConnectionManager(c.getComponent( AxonServerConfiguration.class)); c.onShutdown(axonServerConnectionManager::shutdown); return axonServerConnectionManager; }
@Override public Configurer configureEmbeddedEventStore(Function<Configuration, EventStorageEngine> storageEngineBuilder) { return configureEventStore(c -> { MessageMonitor<Message<?>> monitor = messageMonitorFactoryComponent.get().apply(EmbeddedEventStore.class, "eventStore"); EmbeddedEventStore eventStore = EmbeddedEventStore.builder() .storageEngine(storageEngineBuilder.apply(c)) .messageMonitor(monitor) .build(); c.onShutdown(eventStore::shutDown); return eventStore; }); }
private AxonServerCommandBus buildCommandBus(Configuration c) { AxonServerCommandBus commandBus = new AxonServerCommandBus(c.getComponent(AxonServerConnectionManager.class), c.getComponent(AxonServerConfiguration.class), SimpleCommandBus.builder().build(), c.messageSerializer(), c.getComponent(RoutingStrategy.class, AnnotationRoutingStrategy::new), c.getComponent(CommandPriorityCalculator.class, () -> new CommandPriorityCalculator() {})); c.onShutdown(commandBus::disconnect); return commandBus; }
private QueryBus buildQueryBus(Configuration c) { SimpleQueryBus localSegment = SimpleQueryBus.builder() .transactionManager(c.getComponent(TransactionManager.class, NoTransactionManager::instance)) .errorHandler(c.getComponent(QueryInvocationErrorHandler.class, () -> LoggingQueryInvocationErrorHandler.builder().build())) .queryUpdateEmitter(c.queryUpdateEmitter()) .messageMonitor(c.messageMonitor(QueryBus.class, "localQueryBus")) .build(); AxonServerQueryBus queryBus = new AxonServerQueryBus(c.getComponent(AxonServerConnectionManager.class), c.getComponent(AxonServerConfiguration.class), c.queryUpdateEmitter(), localSegment, c.messageSerializer(), c.serializer(), c.getComponent(QueryPriorityCalculator.class, () -> new QueryPriorityCalculator() {})); c.onShutdown(queryBus::disconnect); return queryBus; }