@Override public <M extends Message<?>> MessageMonitor<? super M> messageMonitor(Class<?> componentType, String componentName) { return config.messageMonitor(componentType, componentName); }
@Override public MessageMonitor<? super Message<?>> messageMonitor(Class<?> componentType, String eventProcessorName) { ensureInitialized(); if (messageMonitorFactories.containsKey(eventProcessorName)) { return messageMonitorFactories.get(eventProcessorName).create(configuration, componentType, eventProcessorName); } else { return configuration.messageMonitor(componentType, eventProcessorName); } }
/** * Provides the default EventBus implementation. Subclasses may override this method to provide their own default. * * @param config The configuration based on which the component is initialized. * @return The default EventBus to use. */ protected EventBus defaultEventBus(Configuration config) { return SimpleEventBus.builder() .messageMonitor(config.messageMonitor(EventBus.class, "eventBus")) .build(); }
/** * Provides the default QueryUpdateEmitter implementation. Subclasses may override this method to provide their own * default. * * @param config The configuration based on which the component is initialized * @return The default QueryUpdateEmitter to use */ protected QueryUpdateEmitter defaultQueryUpdateEmitter(Configuration config) { MessageMonitor<? super SubscriptionQueryUpdateMessage<?>> updateMessageMonitor = config.messageMonitor(QueryUpdateEmitter.class, "queryUpdateEmitter"); return SimpleQueryUpdateEmitter.builder() .updateMessageMonitor(updateMessageMonitor) .build(); }
/** * Provides the default CommandBus implementation. Subclasses may override this method to provide their own default. * * @param config The configuration based on which the component is initialized. * @return The default CommandBus to use. */ protected CommandBus defaultCommandBus(Configuration config) { SimpleCommandBus commandBus = SimpleCommandBus.builder() .transactionManager(config.getComponent(TransactionManager.class, () -> NoTransactionManager.INSTANCE)) .messageMonitor(config.messageMonitor(SimpleCommandBus.class, "commandBus")) .build(); commandBus.registerHandlerInterceptor(new CorrelationDataInterceptor<>(config.correlationDataProviders())); return commandBus; }
/** * Provides the default QueryBus implementations. Subclasses may override this method to provide their own default. * * @param config The configuration based on which the component is initialized. * @return The default QueryBus to use. */ protected QueryBus defaultQueryBus(Configuration config) { return SimpleQueryBus.builder() .messageMonitor(config.messageMonitor(SimpleQueryBus.class, "queryBus")) .transactionManager(config.getComponent(TransactionManager.class, NoTransactionManager::instance)) .errorHandler(config.getComponent( QueryInvocationErrorHandler.class, () -> LoggingQueryInvocationErrorHandler.builder().build() )) .queryUpdateEmitter(config.getComponent(QueryUpdateEmitter.class)) .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; }
private MessageMonitor<? super Message<?>> getMessageMonitor(Configuration configuration, Class<?> componentType, String componentName) { if (messageMonitorFactories.containsKey(componentName)) { return messageMonitorFactories.get(componentName).create(configuration, componentType, componentName); } else { return configuration.messageMonitor(componentType, componentName); } }
/** * Provides the default EventBus implementation. Subclasses may override this method to provide their own default. * * @param config The configuration based on which the component is initialized. * @return The default EventBus to use. */ protected EventBus defaultEventBus(Configuration config) { return new SimpleEventBus(Integer.MAX_VALUE, config.messageMonitor(EventBus.class, "eventBus")); }
private MessageMonitor<? super Message<?>> getMessageMonitor(Configuration config, Class<?> componentType, String componentName) { if (messageMonitorFactories.containsKey(componentName)) { return messageMonitorFactories.get(componentName).create(config, componentType, componentName); } else { return config.messageMonitor(componentType, componentName); } }
@Override public MessageMonitor<? super Message<?>> messageMonitor(Class<?> componentType, String eventProcessorName) { ensureInitialized(); if (messageMonitorFactories.containsKey(eventProcessorName)) { return messageMonitorFactories.get(eventProcessorName).create(configuration, componentType, eventProcessorName); } else { return configuration.messageMonitor(componentType, eventProcessorName); } }
/** * Provides the default QueryBus implementations. Subclasses may override this method to provide their own default. * * @param config The configuration based on which the component is initialized. * @return The default QueryBus to use. */ protected QueryBus defaultQueryBus(Configuration config) { return new SimpleQueryBus(config.messageMonitor(SimpleQueryBus.class, "queryBus"), config.messageMonitor(QueryUpdateEmitter.class, "queryUpdateEmitter"), config.getComponent(TransactionManager.class, NoTransactionManager::instance), config.getComponent(QueryInvocationErrorHandler.class)); }
/** * Provides the default EventBus implementation. Subclasses may override this method to provide their own default. * * @param config The configuration based on which the component is initialized. * @return The default EventBus to use. */ protected EventBus defaultEventBus(Configuration config) { return SimpleEventBus.builder() .messageMonitor(config.messageMonitor(EventBus.class, "eventBus")) .build(); }
/** * Provides the default QueryUpdateEmitter implementation. Subclasses may override this method to provide their own * default. * * @param config The configuration based on which the component is initialized * @return The default QueryUpdateEmitter to use */ protected QueryUpdateEmitter defaultQueryUpdateEmitter(Configuration config) { MessageMonitor<? super SubscriptionQueryUpdateMessage<?>> updateMessageMonitor = config.messageMonitor(QueryUpdateEmitter.class, "queryUpdateEmitter"); return SimpleQueryUpdateEmitter.builder() .updateMessageMonitor(updateMessageMonitor) .build(); }
/** * Provides the default CommandBus implementation. Subclasses may override this method to provide their own default. * * @param config The configuration based on which the component is initialized. * @return The default CommandBus to use. */ protected CommandBus defaultCommandBus(Configuration config) { SimpleCommandBus cb = new SimpleCommandBus(config.getComponent(TransactionManager.class, () -> NoTransactionManager.INSTANCE), config.messageMonitor(SimpleCommandBus.class, "commandBus")); cb.registerHandlerInterceptor(new CorrelationDataInterceptor<>(config.correlationDataProviders())); return cb; }
/** * Provides the default CommandBus implementation. Subclasses may override this method to provide their own default. * * @param config The configuration based on which the component is initialized. * @return The default CommandBus to use. */ protected CommandBus defaultCommandBus(Configuration config) { SimpleCommandBus commandBus = SimpleCommandBus.builder() .transactionManager(config.getComponent(TransactionManager.class, () -> NoTransactionManager.INSTANCE)) .messageMonitor(config.messageMonitor(SimpleCommandBus.class, "commandBus")) .build(); commandBus.registerHandlerInterceptor(new CorrelationDataInterceptor<>(config.correlationDataProviders())); return commandBus; }
/** * Provides the default QueryBus implementations. Subclasses may override this method to provide their own default. * * @param config The configuration based on which the component is initialized. * @return The default QueryBus to use. */ protected QueryBus defaultQueryBus(Configuration config) { return SimpleQueryBus.builder() .messageMonitor(config.messageMonitor(SimpleQueryBus.class, "queryBus")) .transactionManager(config.getComponent(TransactionManager.class, NoTransactionManager::instance)) .errorHandler(config.getComponent( QueryInvocationErrorHandler.class, () -> LoggingQueryInvocationErrorHandler.builder().build() )) .queryUpdateEmitter(config.getComponent(QueryUpdateEmitter.class)) .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; }
); messageMonitor = new Component<>(() -> config, "messageMonitor", c -> c.messageMonitor(eventProcessorType, processorInfo.getProcessingGroup())); tokenStore = new Component<>(() -> config, "tokenStore", c -> c.getComponent(TokenStore.class, InMemoryTokenStore::new));