Search in sources :

Example 6 with MessagingClientProvider

use of org.eclipse.hono.client.util.MessagingClientProvider 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

MessagingClientProvider (org.eclipse.hono.client.util.MessagingClientProvider)6 Buffer (io.vertx.core.buffer.Buffer)5 EventSender (org.eclipse.hono.client.telemetry.EventSender)5 KafkaBasedEventSender (org.eclipse.hono.client.telemetry.kafka.KafkaBasedEventSender)4 ProtonBasedDownstreamSender (org.eclipse.hono.client.telemetry.amqp.ProtonBasedDownstreamSender)3 CommandResponseSender (org.eclipse.hono.client.command.CommandResponseSender)2 CommandRouterClient (org.eclipse.hono.client.command.CommandRouterClient)2 DeviceRegistrationClient (org.eclipse.hono.client.registry.DeviceRegistrationClient)2 TelemetrySender (org.eclipse.hono.client.telemetry.TelemetrySender)2 SpanContext (io.opentracing.SpanContext)1 Context (io.vertx.core.Context)1 Vertx (io.vertx.core.Vertx)1 VertxTestContext (io.vertx.junit5.VertxTestContext)1 MessagingClientProviders (org.eclipse.hono.adapter.MessagingClientProviders)1 CommandConsumerFactory (org.eclipse.hono.client.command.CommandConsumerFactory)1 CommandRouterCommandConsumerFactory (org.eclipse.hono.client.command.CommandRouterCommandConsumerFactory)1 ProtonBasedCommandResponseSender (org.eclipse.hono.client.command.amqp.ProtonBasedCommandResponseSender)1 ProtonBasedCommandRouterClient (org.eclipse.hono.client.command.amqp.ProtonBasedCommandRouterClient)1 ProtonBasedInternalCommandConsumer (org.eclipse.hono.client.command.amqp.ProtonBasedInternalCommandConsumer)1 KafkaBasedCommandResponseSender (org.eclipse.hono.client.command.kafka.KafkaBasedCommandResponseSender)1