From 8766a49890e432e7e33dff853d75cf95cd8f31d4 Mon Sep 17 00:00:00 2001 From: Stefan Freyr Stefansson Date: Wed, 3 Apr 2024 19:31:09 +0000 Subject: [PATCH] Split services/command-router module into services/command-router-base and services/command-router-infinispan. Unit tests and integration tests run. --- bom/pom.xml | 2 +- .../pom.xml | 67 ++------------ .../AdapterInstanceStatusService.java | 0 .../commandrouter/CommandConsumerFactory.java | 0 .../CommandRouterAmqpServer.java | 0 .../commandrouter/CommandRouterMetrics.java | 0 .../commandrouter/CommandRouterResult.java | 0 .../commandrouter/CommandRouterService.java | 0 .../CommandRouterServiceConfigProperties.java | 0 .../CommandRouterServiceOptions.java | 0 .../commandrouter/CommandTargetMapper.java | 0 .../MicrometerBasedCommandRouterMetrics.java | 0 .../app/AbstractApplication.java} | 20 ++-- .../commandrouter/app/MetricsFactory.java | 0 .../impl/AbstractCommandProcessingQueue.java | 0 ...actMappingAndDelegatingCommandHandler.java | 0 .../impl/CommandProcessingQueue.java | 0 .../impl/CommandRouterServiceImpl.java | 0 .../impl/CommandTargetMapperImpl.java | 0 .../DelegatingCommandRouterAmqpEndpoint.java | 0 ...etesBasedAdapterInstanceStatusService.java | 0 .../impl/UnknownStatusProvidingService.java | 0 ...ProtonBasedCommandConsumerFactoryImpl.java | 0 .../ProtonBasedCommandProcessingQueue.java | 0 ...sedMappingAndDelegatingCommandHandler.java | 0 .../InternalKafkaTopicCleanupService.java | 0 .../KafkaBasedCommandConsumerFactoryImpl.java | 0 ...sedMappingAndDelegatingCommandHandler.java | 0 .../kafka/KafkaCommandProcessingQueue.java | 0 ...PubSubBasedCommandConsumerFactoryImpl.java | 0 .../PubSubBasedCommandProcessingQueue.java | 0 ...sedMappingAndDelegatingCommandHandler.java | 0 .../impl/CommandRouterServiceImplTest.java | 0 ...legatingCommandRouterAmqpEndpointTest.java | 0 ...BasedAdapterInstanceStatusServiceTest.java | 0 ...appingAndDelegatingCommandHandlerTest.java | 0 .../InternalKafkaTopicCleanupServiceTest.java | 0 ...appingAndDelegatingCommandHandlerTest.java | 0 .../KafkaCommandProcessingQueueTest.java | 0 ...appingAndDelegatingCommandHandlerTest.java | 0 .../src/test/resources/application.yml | 0 services/command-router-infinispan/pom.xml | 92 +++++++++++++++++++ .../infinispan/app/Application.java | 34 +++++++ ...finispanDeviceConnectionInfoProducer.java} | 6 +- .../native-image.properties | 0 .../main/resources/application-dev.properties | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/default_banner.txt | 2 +- services/pom.xml | 3 +- tests/pom.xml | 4 +- 50 files changed, 153 insertions(+), 77 deletions(-) rename services/{command-router => command-router-base}/pom.xml (65%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/AdapterInstanceStatusService.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/CommandConsumerFactory.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/CommandRouterAmqpServer.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/CommandRouterMetrics.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/CommandRouterResult.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/CommandRouterService.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceConfigProperties.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceOptions.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/CommandTargetMapper.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/MicrometerBasedCommandRouterMetrics.java (100%) rename services/{command-router/src/main/java/org/eclipse/hono/commandrouter/app/Application.java => command-router-base/src/main/java/org/eclipse/hono/commandrouter/app/AbstractApplication.java} (97%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/app/MetricsFactory.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractCommandProcessingQueue.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractMappingAndDelegatingCommandHandler.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/CommandProcessingQueue.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImpl.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/CommandTargetMapperImpl.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpoint.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusService.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/UnknownStatusProvidingService.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandConsumerFactoryImpl.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandProcessingQueue.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandler.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupService.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedCommandConsumerFactoryImpl.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandler.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueue.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandConsumerFactoryImpl.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandProcessingQueue.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandler.java (100%) rename services/{command-router => command-router-base}/src/test/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImplTest.java (100%) rename services/{command-router => command-router-base}/src/test/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpointTest.java (100%) rename services/{command-router => command-router-base}/src/test/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusServiceTest.java (100%) rename services/{command-router => command-router-base}/src/test/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandlerTest.java (100%) rename services/{command-router => command-router-base}/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupServiceTest.java (100%) rename services/{command-router => command-router-base}/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandlerTest.java (100%) rename services/{command-router => command-router-base}/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueueTest.java (100%) rename services/{command-router => command-router-base}/src/test/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandlerTest.java (100%) rename services/{command-router => command-router-base}/src/test/resources/application.yml (100%) create mode 100644 services/command-router-infinispan/pom.xml create mode 100644 services/command-router-infinispan/src/main/java/org/eclipse/hono/commandrouter/infinispan/app/Application.java rename services/{command-router/src/main/java/org/eclipse/hono/commandrouter/app/DeviceConnectionInfoProducer.java => command-router-infinispan/src/main/java/org/eclipse/hono/commandrouter/infinispan/app/InfinispanDeviceConnectionInfoProducer.java} (96%) rename services/{command-router => command-router-infinispan}/src/main/resources/META-INF/native-image/org.eclipse.hono/hono-service-command-router/native-image.properties (100%) rename services/{command-router => command-router-infinispan}/src/main/resources/application-dev.properties (100%) rename services/{command-router => command-router-infinispan}/src/main/resources/application.properties (100%) rename services/{command-router => command-router-infinispan}/src/main/resources/default_banner.txt (92%) diff --git a/bom/pom.xml b/bom/pom.xml index 48412ba49f..2e32c76703 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -427,7 +427,7 @@ quarkus.vertx.max-event-loop-execute-time=${max.event-loop.execute-time:20000} org.eclipse.hono - hono-service-command-router + hono-service-command-router-base ${project.version} diff --git a/services/command-router/pom.xml b/services/command-router-base/pom.xml similarity index 65% rename from services/command-router/pom.xml rename to services/command-router-base/pom.xml index aeaa5a4738..7b32bfc186 100644 --- a/services/command-router/pom.xml +++ b/services/command-router-base/pom.xml @@ -11,7 +11,7 @@ SPDX-License-Identifier: EPL-2.0 --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.eclipse.hono @@ -19,15 +19,16 @@ 2.6.0-SNAPSHOT ../parent - hono-service-command-router - Hono Command Router - A Quarkus based implementation of Hono's Command Router API that is using Infinispan for storing data. + hono-service-command-router-base + Hono Service Command Router Base + Base classes for implementing a Quarkus based Hono Command Router org.eclipse.hono - client-device-connection-infinispan + client-device-connection-base + org.eclipse.hono hono-client-command-amqp @@ -104,58 +105,4 @@ - - - - - io.fabric8 - docker-maven-plugin - - - - - - Command Router - - - 5671 - 5672 - ${health.check.port} - - - - - - - - - - - - - - build-docker-image - - - - io.fabric8 - docker-maven-plugin - - - - - - - build-native-image - - - - io.fabric8 - docker-maven-plugin - - - - - - - + \ No newline at end of file diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/AdapterInstanceStatusService.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/AdapterInstanceStatusService.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/AdapterInstanceStatusService.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/AdapterInstanceStatusService.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandConsumerFactory.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandConsumerFactory.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandConsumerFactory.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandConsumerFactory.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterAmqpServer.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterAmqpServer.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterAmqpServer.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterAmqpServer.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterMetrics.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterMetrics.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterMetrics.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterMetrics.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterResult.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterResult.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterResult.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterResult.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterService.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterService.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterService.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterService.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceConfigProperties.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceConfigProperties.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceConfigProperties.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceConfigProperties.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceOptions.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceOptions.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceOptions.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceOptions.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandTargetMapper.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandTargetMapper.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandTargetMapper.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandTargetMapper.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/MicrometerBasedCommandRouterMetrics.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/MicrometerBasedCommandRouterMetrics.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/MicrometerBasedCommandRouterMetrics.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/MicrometerBasedCommandRouterMetrics.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/Application.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/app/AbstractApplication.java similarity index 97% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/Application.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/app/AbstractApplication.java index 44d98f5da5..49b482b58f 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/Application.java +++ b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/app/AbstractApplication.java @@ -86,20 +86,15 @@ import io.vertx.core.buffer.Buffer; import io.vertx.ext.healthchecks.HealthCheckHandler; import io.vertx.proton.sasl.ProtonSaslAuthenticatorFactory; -import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; /** * The Quarkus based Command Router main application class. */ -@ApplicationScoped -public class Application extends NotificationSupportingServiceApplication { +public abstract class AbstractApplication extends NotificationSupportingServiceApplication { private static final String COMPONENT_NAME = "Hono Command Router"; - private static final Logger LOG = LoggerFactory.getLogger(Application.class); - - @Inject - DeviceConnectionInfo deviceConnectionInfo; + private static final Logger LOG = LoggerFactory.getLogger(AbstractApplication.class); @Inject ProtonSaslAuthenticatorFactory saslAuthenticatorFactory; @@ -349,16 +344,23 @@ public void registerReadinessChecks(final HealthCheckHandler handler) { return endpoint; } + /** + * Gets the repository storing device connection info. + * + * @return The device connection info repository. + */ + protected abstract DeviceConnectionInfo getDeviceConnectionInfo(); + private CommandRouterService commandRouterService() { final DeviceRegistrationClient registrationClient = registrationClient(); final TenantClient tenantClient = tenantClient(); - final var commandTargetMapper = CommandTargetMapper.create(registrationClient, deviceConnectionInfo, tracer); + final var commandTargetMapper = CommandTargetMapper.create(registrationClient, getDeviceConnectionInfo(), tracer); return new CommandRouterServiceImpl( amqpServerProperties, registrationClient, tenantClient, - deviceConnectionInfo, + getDeviceConnectionInfo(), commandConsumerFactoryProvider(tenantClient, commandTargetMapper), eventSenderProvider(), adapterInstanceStatusService, diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/MetricsFactory.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/app/MetricsFactory.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/MetricsFactory.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/app/MetricsFactory.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractCommandProcessingQueue.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractCommandProcessingQueue.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractCommandProcessingQueue.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractCommandProcessingQueue.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractMappingAndDelegatingCommandHandler.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractMappingAndDelegatingCommandHandler.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractMappingAndDelegatingCommandHandler.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractMappingAndDelegatingCommandHandler.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandProcessingQueue.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/CommandProcessingQueue.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandProcessingQueue.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/CommandProcessingQueue.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImpl.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImpl.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImpl.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImpl.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandTargetMapperImpl.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/CommandTargetMapperImpl.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandTargetMapperImpl.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/CommandTargetMapperImpl.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpoint.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpoint.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpoint.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpoint.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusService.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusService.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusService.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusService.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/UnknownStatusProvidingService.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/UnknownStatusProvidingService.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/UnknownStatusProvidingService.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/UnknownStatusProvidingService.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandConsumerFactoryImpl.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandConsumerFactoryImpl.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandConsumerFactoryImpl.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandConsumerFactoryImpl.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandProcessingQueue.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandProcessingQueue.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandProcessingQueue.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandProcessingQueue.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandler.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandler.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandler.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandler.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupService.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupService.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupService.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupService.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedCommandConsumerFactoryImpl.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedCommandConsumerFactoryImpl.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedCommandConsumerFactoryImpl.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedCommandConsumerFactoryImpl.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandler.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandler.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandler.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandler.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueue.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueue.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueue.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueue.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandConsumerFactoryImpl.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandConsumerFactoryImpl.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandConsumerFactoryImpl.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandConsumerFactoryImpl.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandProcessingQueue.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandProcessingQueue.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandProcessingQueue.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandProcessingQueue.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandler.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandler.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandler.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandler.java diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImplTest.java b/services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImplTest.java similarity index 100% rename from services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImplTest.java rename to services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImplTest.java diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpointTest.java b/services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpointTest.java similarity index 100% rename from services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpointTest.java rename to services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpointTest.java diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusServiceTest.java b/services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusServiceTest.java similarity index 100% rename from services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusServiceTest.java rename to services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusServiceTest.java diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandlerTest.java b/services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandlerTest.java similarity index 100% rename from services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandlerTest.java rename to services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandlerTest.java diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupServiceTest.java b/services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupServiceTest.java similarity index 100% rename from services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupServiceTest.java rename to services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupServiceTest.java diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandlerTest.java b/services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandlerTest.java similarity index 100% rename from services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandlerTest.java rename to services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandlerTest.java diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueueTest.java b/services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueueTest.java similarity index 100% rename from services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueueTest.java rename to services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueueTest.java diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandlerTest.java b/services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandlerTest.java similarity index 100% rename from services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandlerTest.java rename to services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandlerTest.java diff --git a/services/command-router/src/test/resources/application.yml b/services/command-router-base/src/test/resources/application.yml similarity index 100% rename from services/command-router/src/test/resources/application.yml rename to services/command-router-base/src/test/resources/application.yml diff --git a/services/command-router-infinispan/pom.xml b/services/command-router-infinispan/pom.xml new file mode 100644 index 0000000000..bfbcb5e456 --- /dev/null +++ b/services/command-router-infinispan/pom.xml @@ -0,0 +1,92 @@ + + + 4.0.0 + + org.eclipse.hono + hono-services-parent + 2.6.0-SNAPSHOT + ../parent + + hono-service-command-router-infinispan + Hono Infinispan Based Command Router + A Quarkus based implementation of Hono's Command Router API that is using Infinispan for storing data. + + + + org.eclipse.hono + hono-service-command-router-base + + + + org.eclipse.hono + client-device-connection-infinispan + + + + + + + + io.fabric8 + docker-maven-plugin + + + + + + Command Router + + + 5671 + 5672 + ${health.check.port} + + + + + + + + + + + + + + build-docker-image + + + + io.fabric8 + docker-maven-plugin + + + + + + + build-native-image + + + + io.fabric8 + docker-maven-plugin + + + + + + + \ No newline at end of file diff --git a/services/command-router-infinispan/src/main/java/org/eclipse/hono/commandrouter/infinispan/app/Application.java b/services/command-router-infinispan/src/main/java/org/eclipse/hono/commandrouter/infinispan/app/Application.java new file mode 100644 index 0000000000..c62cc3c59f --- /dev/null +++ b/services/command-router-infinispan/src/main/java/org/eclipse/hono/commandrouter/infinispan/app/Application.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.hono.commandrouter.infinispan.app; + +import org.eclipse.hono.commandrouter.app.AbstractApplication; +import org.eclipse.hono.deviceconnection.common.DeviceConnectionInfo; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +/** + * The Quarkus based Command Router main application class (Infinispan variant). + */ +@ApplicationScoped +public class Application extends AbstractApplication { + + @Inject + DeviceConnectionInfo deviceConnectionInfo; + + @Override + protected DeviceConnectionInfo getDeviceConnectionInfo() { + return deviceConnectionInfo; + } +} diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/DeviceConnectionInfoProducer.java b/services/command-router-infinispan/src/main/java/org/eclipse/hono/commandrouter/infinispan/app/InfinispanDeviceConnectionInfoProducer.java similarity index 96% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/DeviceConnectionInfoProducer.java rename to services/command-router-infinispan/src/main/java/org/eclipse/hono/commandrouter/infinispan/app/InfinispanDeviceConnectionInfoProducer.java index 736235996f..072c8134ac 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/DeviceConnectionInfoProducer.java +++ b/services/command-router-infinispan/src/main/java/org/eclipse/hono/commandrouter/infinispan/app/InfinispanDeviceConnectionInfoProducer.java @@ -12,7 +12,7 @@ */ -package org.eclipse.hono.commandrouter.app; +package org.eclipse.hono.commandrouter.infinispan.app; import java.io.IOException; import java.nio.file.Files; @@ -55,9 +55,9 @@ * on whether a remote cache config with a non-empty server list is used or not. */ @ApplicationScoped -public class DeviceConnectionInfoProducer { +public class InfinispanDeviceConnectionInfoProducer { - private static final Logger LOG = LoggerFactory.getLogger(DeviceConnectionInfoProducer.class); + private static final Logger LOG = LoggerFactory.getLogger(InfinispanDeviceConnectionInfoProducer.class); @ConfigProperty(name = "hono.commandRouter.cache.embedded.configurationFile", defaultValue = "/etc/hono/cache-config.xml") String configFile; diff --git a/services/command-router/src/main/resources/META-INF/native-image/org.eclipse.hono/hono-service-command-router/native-image.properties b/services/command-router-infinispan/src/main/resources/META-INF/native-image/org.eclipse.hono/hono-service-command-router/native-image.properties similarity index 100% rename from services/command-router/src/main/resources/META-INF/native-image/org.eclipse.hono/hono-service-command-router/native-image.properties rename to services/command-router-infinispan/src/main/resources/META-INF/native-image/org.eclipse.hono/hono-service-command-router/native-image.properties diff --git a/services/command-router/src/main/resources/application-dev.properties b/services/command-router-infinispan/src/main/resources/application-dev.properties similarity index 100% rename from services/command-router/src/main/resources/application-dev.properties rename to services/command-router-infinispan/src/main/resources/application-dev.properties diff --git a/services/command-router/src/main/resources/application.properties b/services/command-router-infinispan/src/main/resources/application.properties similarity index 100% rename from services/command-router/src/main/resources/application.properties rename to services/command-router-infinispan/src/main/resources/application.properties diff --git a/services/command-router/src/main/resources/default_banner.txt b/services/command-router-infinispan/src/main/resources/default_banner.txt similarity index 92% rename from services/command-router/src/main/resources/default_banner.txt rename to services/command-router-infinispan/src/main/resources/default_banner.txt index ee1eac25ce..6ff38647e3 100644 --- a/services/command-router/src/main/resources/default_banner.txt +++ b/services/command-router-infinispan/src/main/resources/default_banner.txt @@ -8,7 +8,7 @@ | | |_| -Eclipse Hono Command Router +Eclipse Hono Infinispan Based Command Router Go to https://www.eclipse.org/hono for more information. diff --git a/services/pom.xml b/services/pom.xml index 416fc18f64..4af2a47055 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -30,7 +30,8 @@ auth auth-base base-jdbc - command-router + command-router-base + command-router-infinispan device-registry-base device-registry-jdbc device-registry-mongodb diff --git a/tests/pom.xml b/tests/pom.xml index b7466c33bc..a861133063 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -85,7 +85,7 @@ Command Router related properties. --> clustered-cache - hono-service-command-router + hono-service-command-router-infinispan 300000000 ${default.java-options} @@ -264,7 +264,7 @@ org.eclipse.hono - hono-service-command-router + hono-service-command-router-base test