Search in sources :

Example 1 with AdapterInstanceStatusService

use of org.eclipse.hono.commandrouter.AdapterInstanceStatusService in project hono by eclipse.

the class InternalKafkaTopicCleanupServiceTest method setUp.

/**
 * Sets up fixture.
 */
@BeforeEach
public void setUp() {
    final Vertx vertx = mock(Vertx.class);
    adapterInstanceStatusService = mock(AdapterInstanceStatusService.class);
    kafkaAdminClient = mock(KafkaAdminClient.class);
    internalKafkaTopicCleanupService = new InternalKafkaTopicCleanupService(vertx, adapterInstanceStatusService, kafkaAdminClient);
    internalKafkaTopicCleanupService.start();
}
Also used : AdapterInstanceStatusService(org.eclipse.hono.commandrouter.AdapterInstanceStatusService) KafkaAdminClient(io.vertx.kafka.admin.KafkaAdminClient) Vertx(io.vertx.core.Vertx) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with AdapterInstanceStatusService

use of org.eclipse.hono.commandrouter.AdapterInstanceStatusService 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

AdapterInstanceStatusService (org.eclipse.hono.commandrouter.AdapterInstanceStatusService)2 Vertx (io.vertx.core.Vertx)1 Buffer (io.vertx.core.buffer.Buffer)1 KafkaAdminClient (io.vertx.kafka.admin.KafkaAdminClient)1 MessagingClientProvider (org.eclipse.hono.client.util.MessagingClientProvider)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 BeforeEach (org.junit.jupiter.api.BeforeEach)1