private AxonServerEventStore buildEventStore(Configuration c) { return AxonServerEventStore.builder() .configuration(c.getComponent(AxonServerConfiguration.class)) .platformConnectionManager(c.getComponent(AxonServerConnectionManager.class)) .snapshotSerializer(c.serializer()) .eventSerializer(c.eventSerializer()) .upcasterChain(c.upcasterChain()) .build(); }
.configureEmbeddedEventStore( c -> JpaEventStorageEngine.builder() .snapshotSerializer(c.serializer()) .upcasterChain(c.upcasterChain()) .persistenceExceptionResolver( c -> JpaTokenStore.builder() .entityManagerProvider(c.getComponent(EntityManagerProvider.class)) .serializer(c.serializer()) .build()) .registerComponent(SagaStore.class, c -> JpaSagaStore.builder() .entityManagerProvider(c.getComponent(EntityManagerProvider.class)) .serializer(c.serializer()) .build());
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; }
.registerComponent(TransactionManager.class, c -> transactionManager) .configureEmbeddedEventStore(c -> new JpaEventStorageEngine( c.serializer(), c.upcasterChain(), c.getComponent(PersistenceExceptionResolver.class), .registerComponent(TokenStore.class, c -> new JpaTokenStore(c.getComponent(EntityManagerProvider.class), c.serializer())) .registerComponent(SagaStore.class, c -> new JpaSagaStore(c.serializer(), c.getComponent(EntityManagerProvider.class)));
private AxonServerEventStore buildEventStore(Configuration c) { return AxonServerEventStore.builder() .configuration(c.getComponent(AxonServerConfiguration.class)) .platformConnectionManager(c.getComponent(AxonServerConnectionManager.class)) .snapshotSerializer(c.serializer()) .eventSerializer(c.eventSerializer()) .upcasterChain(c.upcasterChain()) .build(); }
.configureEmbeddedEventStore( c -> JpaEventStorageEngine.builder() .snapshotSerializer(c.serializer()) .upcasterChain(c.upcasterChain()) .persistenceExceptionResolver( c -> JpaTokenStore.builder() .entityManagerProvider(c.getComponent(EntityManagerProvider.class)) .serializer(c.serializer()) .build()) .registerComponent(SagaStore.class, c -> JpaSagaStore.builder() .entityManagerProvider(c.getComponent(EntityManagerProvider.class)) .serializer(c.serializer()) .build());
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; }