Search in sources :

Example 1 with ProtonBasedCommandConsumerFactoryImpl

use of org.eclipse.hono.commandrouter.impl.amqp.ProtonBasedCommandConsumerFactoryImpl in project hono by eclipse.

the class Application method commandConsumerFactoryProvider.

private MessagingClientProvider<CommandConsumerFactory> commandConsumerFactoryProvider(final TenantClient tenantClient, final CommandTargetMapper commandTargetMapper) {
    final MessagingClientProvider<CommandConsumerFactory> commandConsumerFactoryProvider = new MessagingClientProvider<>();
    if (kafkaConsumerConfig.isConfigured() && commandResponseKafkaProducerConfig.isConfigured() && commandInternalKafkaProducerConfig.isConfigured()) {
        final KafkaProducerFactory<String, Buffer> kafkaProducerFactory = CachingKafkaProducerFactory.sharedFactory(vertx);
        kafkaProducerFactory.setMetricsSupport(kafkaClientMetricsSupport);
        if (internalKafkaTopicCleanupService == null && commandInternalKafkaProducerConfig.isConfigured() && kafkaConsumerConfig.isConfigured() && kafkaAdminClientConfig.isConfigured() && !(adapterInstanceStatusService instanceof AdapterInstanceStatusService.UnknownStatusProvidingService)) {
            internalKafkaTopicCleanupService = new InternalKafkaTopicCleanupService(vertx, adapterInstanceStatusService, kafkaAdminClientConfig);
        }
        commandConsumerFactoryProvider.setClient(new KafkaBasedCommandConsumerFactoryImpl(vertx, tenantClient, commandTargetMapper, kafkaProducerFactory, commandInternalKafkaProducerConfig, commandResponseKafkaProducerConfig, kafkaConsumerConfig, metrics, kafkaClientMetricsSupport, tracer, internalKafkaTopicCleanupService));
    }
    if (commandConsumerConnectionConfig.isHostConfigured()) {
        commandConsumerFactoryProvider.setClient(new ProtonBasedCommandConsumerFactoryImpl(HonoConnection.newConnection(vertx, commandConsumerConnectionConfig, tracer), tenantClient, commandTargetMapper, metrics, SendMessageSampler.Factory.noop()));
    }
    return commandConsumerFactoryProvider;
}
Also used : Buffer(io.vertx.core.buffer.Buffer) AdapterInstanceStatusService(org.eclipse.hono.commandrouter.AdapterInstanceStatusService) MessagingClientProvider(org.eclipse.hono.client.util.MessagingClientProvider) InternalKafkaTopicCleanupService(org.eclipse.hono.commandrouter.impl.kafka.InternalKafkaTopicCleanupService) KafkaBasedCommandConsumerFactoryImpl(org.eclipse.hono.commandrouter.impl.kafka.KafkaBasedCommandConsumerFactoryImpl) CommandConsumerFactory(org.eclipse.hono.commandrouter.CommandConsumerFactory) ProtonBasedCommandConsumerFactoryImpl(org.eclipse.hono.commandrouter.impl.amqp.ProtonBasedCommandConsumerFactoryImpl)

Aggregations

Buffer (io.vertx.core.buffer.Buffer)1 MessagingClientProvider (org.eclipse.hono.client.util.MessagingClientProvider)1 AdapterInstanceStatusService (org.eclipse.hono.commandrouter.AdapterInstanceStatusService)1 CommandConsumerFactory (org.eclipse.hono.commandrouter.CommandConsumerFactory)1 ProtonBasedCommandConsumerFactoryImpl (org.eclipse.hono.commandrouter.impl.amqp.ProtonBasedCommandConsumerFactoryImpl)1 InternalKafkaTopicCleanupService (org.eclipse.hono.commandrouter.impl.kafka.InternalKafkaTopicCleanupService)1 KafkaBasedCommandConsumerFactoryImpl (org.eclipse.hono.commandrouter.impl.kafka.KafkaBasedCommandConsumerFactoryImpl)1