/** * Initializes a {@link LoggingQueryInvocationErrorHandler} as specified through this Builder. * * @return a {@link LoggingQueryInvocationErrorHandler} as specified through this Builder */ public LoggingQueryInvocationErrorHandler build() { return new LoggingQueryInvocationErrorHandler(this); }
/** * Initialize the query bus using given {@code transactionManager} to manage transactions around query execution * with. No monitoring is applied to messages and a {@link LoggingQueryInvocationErrorHandler} is used * to log errors on handlers during a scatter-gather query. * * @param transactionManager The transaction manager to manage transactions around query execution with */ public SimpleQueryBus(TransactionManager transactionManager) { this(NoOpMessageMonitor.INSTANCE, transactionManager, new LoggingQueryInvocationErrorHandler(logger)); }
/** * Initializes a {@link LoggingQueryInvocationErrorHandler} as specified through this Builder. * * @return a {@link LoggingQueryInvocationErrorHandler} as specified through this Builder */ public LoggingQueryInvocationErrorHandler build() { return new LoggingQueryInvocationErrorHandler(this); }
/** * Initialize the query bus without monitoring on messages and a {@link LoggingQueryInvocationErrorHandler}. */ public SimpleQueryBus() { this(NoOpMessageMonitor.INSTANCE, NoTransactionManager.instance(), new LoggingQueryInvocationErrorHandler(logger)); }
/** * Initialize the query bus with the given {@code messageMonitor}, {@code updateMessageMonitor}, {@code * transactionManager} and given {@code errorHandler}. * * @param messageMonitor The message monitor notified for incoming messages and their result * @param updateMessageMonitor The message monitor notified for incoming update message in regard to subscription * queries * @param transactionManager The transaction manager to manage transactions around query execution with * @param errorHandler The error handler to invoke when query handler report an error */ public SimpleQueryBus(MessageMonitor<? super QueryMessage<?, ?>> messageMonitor, MessageMonitor<? super SubscriptionQueryUpdateMessage<?>> updateMessageMonitor, TransactionManager transactionManager, QueryInvocationErrorHandler errorHandler) { this.messageMonitor = messageMonitor != null ? messageMonitor : NoOpMessageMonitor.instance(); this.updateMessageMonitor = updateMessageMonitor != null ? updateMessageMonitor : NoOpMessageMonitor.instance(); this.errorHandler = getOrDefault(errorHandler, () -> new LoggingQueryInvocationErrorHandler(logger)); if (transactionManager != null) { registerHandlerInterceptor(new TransactionManagingInterceptor<>(transactionManager)); } }