This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 5a6bebad5 improvement: Harmonize minimal setup (#2134)
5a6bebad5 is described below
commit 5a6bebad52fc887529b8603bc64396b7f4927e94
Author: Dominik Riemer <[email protected]>
AuthorDate: Sun Nov 5 18:48:21 2023 +0100
improvement: Harmonize minimal setup (#2134)
* improvement: Rename core-nats to core-minimal module, add MQTT as protocol
* Improve exception logging, remove startup check
* Fix checkstyle
---
.github/workflows/build.yml | 6 +++---
pom.xml | 2 +-
.../streampipes-extensions-iiot-minimal/pom.xml | 6 ++++++
.../iiot/minimal/ExtensionsIIoTMinimalInit.java | 4 +++-
.../streampipes/manager/endpoint/EndpointItemFetcher.java | 6 +++++-
.../streampipes/manager/health/ServiceHealthCheck.java | 6 +-----
.../Dockerfile | 2 +-
.../pom.xml | 15 ++++++++-------
.../core/minimal/StreamPipesCoreApplicationMinimal.java | 10 ++++++----
9 files changed, 34 insertions(+), 23 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 5ee7ff782..87da605b2 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -70,13 +70,13 @@ jobs:
push: true
tags: ${{ env.DOCKERHUB_APACHE_REPO }}/backend:${{ env.MVN_VERSION }}
- - name: Build and Push Docker Backend Nats Image
+ - name: Build and Push Docker Core Minimal Image
uses: docker/build-push-action@v5
with:
- context: ./streampipes-service-core-nats
+ context: ./streampipes-service-core-minimal
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7
push: true
- tags: ${{ env.DOCKERHUB_APACHE_REPO }}/backend-nats:${{
env.MVN_VERSION }}
+ tags: ${{ env.DOCKERHUB_APACHE_REPO }}/backend-minimal:${{
env.MVN_VERSION }}
- name: Build UI
working-directory: ./ui
diff --git a/pom.xml b/pom.xml
index cf1246ffc..3ec3c1e1a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1358,7 +1358,7 @@
<module>streampipes-serializers-json</module>
<module>streampipes-service-base</module>
<module>streampipes-service-core</module>
- <module>streampipes-service-core-nats</module>
+ <module>streampipes-service-core-minimal</module>
<module>streampipes-service-discovery</module>
<module>streampipes-service-discovery-consul</module>
<module>streampipes-service-discovery-api</module>
diff --git a/streampipes-extensions/streampipes-extensions-iiot-minimal/pom.xml
b/streampipes-extensions/streampipes-extensions-iiot-minimal/pom.xml
index 6fdd27954..7a986aa2f 100644
--- a/streampipes-extensions/streampipes-extensions-iiot-minimal/pom.xml
+++ b/streampipes-extensions/streampipes-extensions-iiot-minimal/pom.xml
@@ -61,6 +61,12 @@
<version>0.93.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.streampipes</groupId>
+ <artifactId>streampipes-messaging-mqtt</artifactId>
+ <version>0.93.0-SNAPSHOT</version>
+ </dependency>
+
<dependency>
<groupId>org.apache.streampipes</groupId>
<artifactId>streampipes-processors-filters-jvm</artifactId>
diff --git
a/streampipes-extensions/streampipes-extensions-iiot-minimal/src/main/java/org/apache/streampipes/extensions/iiot/minimal/ExtensionsIIoTMinimalInit.java
b/streampipes-extensions/streampipes-extensions-iiot-minimal/src/main/java/org/apache/streampipes/extensions/iiot/minimal/ExtensionsIIoTMinimalInit.java
index 5861455e3..e609b018c 100644
---
a/streampipes-extensions/streampipes-extensions-iiot-minimal/src/main/java/org/apache/streampipes/extensions/iiot/minimal/ExtensionsIIoTMinimalInit.java
+++
b/streampipes-extensions/streampipes-extensions-iiot-minimal/src/main/java/org/apache/streampipes/extensions/iiot/minimal/ExtensionsIIoTMinimalInit.java
@@ -30,6 +30,7 @@ import
org.apache.streampipes.extensions.connectors.opcua.OpcUaConnectorsModuleE
import
org.apache.streampipes.extensions.connectors.plc.PlcConnectorsModuleExport;
import org.apache.streampipes.extensions.management.model.SpServiceDefinition;
import
org.apache.streampipes.extensions.management.model.SpServiceDefinitionBuilder;
+import org.apache.streampipes.messaging.mqtt.SpMqttProtocolFactory;
import org.apache.streampipes.messaging.nats.SpNatsProtocolFactory;
import
org.apache.streampipes.processors.changedetection.jvm.ChangeDetectionExtensionModuleExport;
import
org.apache.streampipes.processors.enricher.jvm.EnricherExtensionModuleExport;
@@ -79,7 +80,8 @@ public class ExtensionsIIoTMinimalInit extends
ExtensionsModelSubmitter {
new SmileDataFormatFactory(),
new FstDataFormatFactory())
.registerMessagingProtocols(
- new SpNatsProtocolFactory()
+ new SpNatsProtocolFactory(),
+ new SpMqttProtocolFactory()
)
.build();
}
diff --git
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/endpoint/EndpointItemFetcher.java
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/endpoint/EndpointItemFetcher.java
index 2fd3a4ef9..f7a4974d0 100644
---
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/endpoint/EndpointItemFetcher.java
+++
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/endpoint/EndpointItemFetcher.java
@@ -59,7 +59,11 @@ public class EndpointItemFetcher {
.readValue(result, new TypeReference<>() {
});
} catch (IOException e1) {
- logger.warn("Processing Element Descriptions could not be fetched from
endpoint: " + e.getEndpointUrl(), e1);
+ logger.warn(
+ "Processing Element Descriptions could not be fetched from endpoint
{}: {} ",
+ e.getEndpointUrl(),
+ e1.getMessage()
+ );
return Collections.emptyList();
}
}
diff --git
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/health/ServiceHealthCheck.java
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/health/ServiceHealthCheck.java
index 88c9292ae..abb1dc5ea 100644
---
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/health/ServiceHealthCheck.java
+++
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/health/ServiceHealthCheck.java
@@ -56,7 +56,7 @@ public class ServiceHealthCheck implements Runnable {
try {
var request =
ExtensionServiceExecutions.extServiceGetRequest(healthCheckUrl);
var response = request.execute();
- if (response.returnResponse().getStatusLine().getStatusCode() !=
HttpStatus.SC_OK && !isStarting(service)) {
+ if (response.returnResponse().getStatusLine().getStatusCode() !=
HttpStatus.SC_OK) {
processUnhealthyService(service);
} else {
if (service.getStatus() == SpServiceStatus.UNHEALTHY) {
@@ -68,10 +68,6 @@ public class ServiceHealthCheck implements Runnable {
}
}
- private boolean isStarting(SpServiceRegistration service) {
- return service.getStatus() == SpServiceStatus.REGISTERED ||
service.getStatus() == SpServiceStatus.MIGRATING;
- }
-
private void processUnhealthyService(SpServiceRegistration service) {
if (service.getStatus() == SpServiceStatus.HEALTHY) {
serviceRegistrationManager.applyServiceStatus(
diff --git a/streampipes-service-core-nats/Dockerfile
b/streampipes-service-core-minimal/Dockerfile
similarity index 93%
rename from streampipes-service-core-nats/Dockerfile
rename to streampipes-service-core-minimal/Dockerfile
index fd2c7ffe9..7970c3e71 100644
--- a/streampipes-service-core-nats/Dockerfile
+++ b/streampipes-service-core-minimal/Dockerfile
@@ -15,6 +15,6 @@
FROM eclipse-temurin:17-jre-focal
-COPY target/streampipes-core-nats.jar /streampipes-core.jar
+COPY target/streampipes-core-minimal.jar /streampipes-core.jar
ENTRYPOINT ["java", "-jar", "/streampipes-core.jar"]
diff --git a/streampipes-service-core-nats/pom.xml
b/streampipes-service-core-minimal/pom.xml
similarity index 90%
rename from streampipes-service-core-nats/pom.xml
rename to streampipes-service-core-minimal/pom.xml
index 7eb181727..4559a9815 100644
--- a/streampipes-service-core-nats/pom.xml
+++ b/streampipes-service-core-minimal/pom.xml
@@ -27,7 +27,7 @@
<version>0.93.0-SNAPSHOT</version>
</parent>
- <artifactId>streampipes-service-core-nats</artifactId>
+ <artifactId>streampipes-service-core-minimal</artifactId>
<dependencies>
<dependency>
@@ -40,10 +40,6 @@
<groupId>org.apache.streampipes</groupId>
<artifactId>streampipes-messaging-jms</artifactId>
</exclusion>
- <exclusion>
- <groupId>org.apache.streampipes</groupId>
- <artifactId>streampipes-messaging-mqtt</artifactId>
- </exclusion>
<exclusion>
<groupId>org.apache.streampipes</groupId>
<artifactId>streampipes-messaging-kafka</artifactId>
@@ -54,6 +50,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.streampipes</groupId>
+ <artifactId>streampipes-messaging-mqtt</artifactId>
+ <version>0.93.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
<build>
@@ -67,7 +68,7 @@
<goal>repackage</goal>
</goals>
<configuration>
-
<mainClass>org.apache.streampipes.service.core.nats.StreamPipesCoreApplicationNats
+
<mainClass>org.apache.streampipes.service.core.minimal.StreamPipesCoreApplicationMinimal
</mainClass>
</configuration>
</execution>
@@ -88,7 +89,7 @@
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
</plugins>
- <finalName>streampipes-core-nats</finalName>
+ <finalName>streampipes-core-minimal</finalName>
</build>
</project>
diff --git
a/streampipes-service-core-nats/src/main/java/org/apache/streampipes/service/core/nats/StreamPipesCoreApplicationNats.java
b/streampipes-service-core-minimal/src/main/java/org/apache/streampipes/service/core/minimal/StreamPipesCoreApplicationMinimal.java
similarity index 84%
rename from
streampipes-service-core-nats/src/main/java/org/apache/streampipes/service/core/nats/StreamPipesCoreApplicationNats.java
rename to
streampipes-service-core-minimal/src/main/java/org/apache/streampipes/service/core/minimal/StreamPipesCoreApplicationMinimal.java
index bf441d21a..a580eab51 100644
---
a/streampipes-service-core-nats/src/main/java/org/apache/streampipes/service/core/nats/StreamPipesCoreApplicationNats.java
+++
b/streampipes-service-core-minimal/src/main/java/org/apache/streampipes/service/core/minimal/StreamPipesCoreApplicationMinimal.java
@@ -16,8 +16,9 @@
*
*/
-package org.apache.streampipes.service.core.nats;
+package org.apache.streampipes.service.core.minimal;
+import org.apache.streampipes.messaging.mqtt.SpMqttProtocolFactory;
import org.apache.streampipes.messaging.nats.SpNatsProtocolFactory;
import org.apache.streampipes.rest.security.SpPermissionEvaluator;
import org.apache.streampipes.service.core.StreamPipesCoreApplication;
@@ -42,12 +43,13 @@ import java.util.List;
SpPermissionEvaluator.class
})
@ComponentScan({"org.apache.streampipes.rest.*"})
-public class StreamPipesCoreApplicationNats extends StreamPipesCoreApplication
{
+public class StreamPipesCoreApplicationMinimal extends
StreamPipesCoreApplication {
public static void main(String[] args) {
- var application = new StreamPipesCoreApplicationNats();
+ var application = new StreamPipesCoreApplicationMinimal();
application.initialize(() -> List.of(
- new SpNatsProtocolFactory()
+ new SpNatsProtocolFactory(),
+ new SpMqttProtocolFactory()
));
}
}