/** * Instantiate a {@link CommandGatewayFactory} based on the fields contained in the {@link Builder}. * <p> * Will assert that the {@link CommandBus} is not {@code null}, and will throw an * {@link AxonConfigurationException} if it is {@code null}. * * @param builder the {@link Builder} used to instantiate a {@link CommandGatewayFactory} instance */ protected CommandGatewayFactory(Builder builder) { builder.validate(); this.commandBus = builder.commandBus; this.retryScheduler = builder.retryScheduler; if (builder.dispatchInterceptors != null && !builder.dispatchInterceptors.isEmpty()) { this.dispatchInterceptors = new CopyOnWriteArrayList<>(builder.dispatchInterceptors); } else { this.dispatchInterceptors = new CopyOnWriteArrayList<>(); } this.commandCallbacks = new CopyOnWriteArrayList<>(); }
/** * Instantiate a {@link CommandGatewayFactory} based on the fields contained in the {@link Builder}. * <p> * Will assert that the {@link CommandBus} is not {@code null}, and will throw an * {@link AxonConfigurationException} if it is {@code null}. * * @param builder the {@link Builder} used to instantiate a {@link CommandGatewayFactory} instance */ protected CommandGatewayFactory(Builder builder) { builder.validate(); this.commandBus = builder.commandBus; this.retryScheduler = builder.retryScheduler; if (builder.dispatchInterceptors != null && !builder.dispatchInterceptors.isEmpty()) { this.dispatchInterceptors = new CopyOnWriteArrayList<>(builder.dispatchInterceptors); } else { this.dispatchInterceptors = new CopyOnWriteArrayList<>(); } this.commandCallbacks = new CopyOnWriteArrayList<>(); }