@Inject public NonblockingConsumersSupervisor(ConfigFactory configFactory, ConsumersExecutorService executor, ConsumerFactory consumerFactory, OffsetQueue offsetQueue, Retransmitter retransmitter, UndeliveredMessageLogPersister undeliveredMessageLogPersister, SubscriptionRepository subscriptionRepository, HermesMetrics metrics, ConsumerMonitor monitor, Clock clock) { this.undeliveredMessageLogPersister = undeliveredMessageLogPersister; this.subscriptionRepository = subscriptionRepository; this.configs = configFactory; this.backgroundProcess = new ConsumerProcessSupervisor(executor, clock, metrics, configFactory, new ConsumerProcessFactory(retransmitter, consumerFactory, configs, clock)); this.scheduledExecutor = createExecutorForSupervision(); this.offsetCommitter = new OffsetCommitter( offsetQueue, (offsets) -> offsets.subscriptionNames().forEach(subscription -> backgroundProcess.accept(Signal.of(COMMIT, subscription, offsets.batchFor(subscription))) ), configFactory.getIntProperty(Configs.CONSUMER_COMMIT_OFFSET_PERIOD), metrics ); monitor.register(SUBSCRIPTIONS, backgroundProcess::runningSubscriptionsStatus); monitor.register(SUBSCRIPTIONS_COUNT, backgroundProcess::countRunningProcesses); }
@Inject public NonblockingConsumersSupervisor(ConfigFactory configFactory, ConsumersExecutorService executor, ConsumerFactory consumerFactory, OffsetQueue offsetQueue, Retransmitter retransmitter, UndeliveredMessageLogPersister undeliveredMessageLogPersister, SubscriptionRepository subscriptionRepository, HermesMetrics metrics, ConsumerMonitor monitor, Clock clock) { this.undeliveredMessageLogPersister = undeliveredMessageLogPersister; this.subscriptionRepository = subscriptionRepository; this.configs = configFactory; this.backgroundProcess = new ConsumerProcessSupervisor(executor, clock, metrics, configFactory, new ConsumerProcessFactory(retransmitter, consumerFactory, configs, clock)); this.scheduledExecutor = createExecutorForSupervision(); this.offsetCommitter = new OffsetCommitter( offsetQueue, (offsets) -> offsets.subscriptionNames().forEach(subscription -> backgroundProcess.accept(Signal.of(COMMIT, subscription, offsets.batchFor(subscription))) ), configFactory.getIntProperty(Configs.CONSUMER_COMMIT_OFFSET_PERIOD), metrics ); monitor.register(SUBSCRIPTIONS, backgroundProcess::runningSubscriptionsStatus); monitor.register(SUBSCRIPTIONS_COUNT, backgroundProcess::countRunningProcesses); }