diff --git a/src/automation/.env.example b/src/automation/.env.example index 35c4e0b97f715c3c0a6ff961f209070eae547590..98c75623cb55ecb40cfe1c77c01ddb86d433a932 100644 --- a/src/automation/.env.example +++ b/src/automation/.env.example @@ -1,5 +1,5 @@ # Define the host for the Context Service -quarkus.kubernetes.env.vars.context-service-host=context +quarkus.kubernetes.env.vars.context-service-host=ContextService # Define the host for the Device Service -quarkus.kubernetes.env.vars.device-service-host=device \ No newline at end of file +quarkus.kubernetes.env.vars.device-service-host=DeviceService \ No newline at end of file diff --git a/src/automation/src/main/java/eu/teraflow/automation/ContextSubscriber.java b/src/automation/src/main/java/eu/teraflow/automation/ContextSubscriber.java index cedbce546d400a10f6cd3334d3fc443b430db3b4..195634d00bb17debb623e164d975288488a9a240 100644 --- a/src/automation/src/main/java/eu/teraflow/automation/ContextSubscriber.java +++ b/src/automation/src/main/java/eu/teraflow/automation/ContextSubscriber.java @@ -4,6 +4,7 @@ import eu.teraflow.automation.context.ContextService; import eu.teraflow.automation.device.model.DeviceEvent; import io.quarkus.runtime.StartupEvent; import io.smallrye.mutiny.Multi; +import java.time.Duration; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.event.Observes; import javax.inject.Inject; @@ -29,7 +30,15 @@ public class ContextSubscriber { } public void listenForDeviceEvents() { - Multi<DeviceEvent> deviceEventsMulti = contextService.getDeviceEvents(); + + Multi<DeviceEvent> deviceEventsMulti = + contextService + .getDeviceEvents() + .onFailure() + .retry() + .withBackOff(Duration.ofSeconds(1)) + .withJitter(0.2) + .atMost(10); deviceEventsMulti .onItem() diff --git a/src/automation/src/main/java/eu/teraflow/automation/SimpleLivenessCheck.java b/src/automation/src/main/java/eu/teraflow/automation/SimpleLivenessCheck.java index ee4686b63ff9e90f0be8cda9cee4e363bf6d7507..28c896fbd97a63df67d5986a6d1a2fc53b1c62c6 100644 --- a/src/automation/src/main/java/eu/teraflow/automation/SimpleLivenessCheck.java +++ b/src/automation/src/main/java/eu/teraflow/automation/SimpleLivenessCheck.java @@ -11,6 +11,6 @@ public class SimpleLivenessCheck implements HealthCheck { @Override public HealthCheckResponse call() { - return HealthCheckResponse.up("Automation Service"); + return HealthCheckResponse.up("Automation Service is live"); } } diff --git a/src/automation/src/main/java/eu/teraflow/automation/SimpleReadinessCheck.java b/src/automation/src/main/java/eu/teraflow/automation/SimpleReadinessCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..e542a3582855ae4a81273520f4075f9038f61d43 --- /dev/null +++ b/src/automation/src/main/java/eu/teraflow/automation/SimpleReadinessCheck.java @@ -0,0 +1,17 @@ +package eu.teraflow.automation; + +import javax.enterprise.context.ApplicationScoped; +import org.eclipse.microprofile.health.HealthCheck; +import org.eclipse.microprofile.health.HealthCheckResponse; +import org.eclipse.microprofile.health.Readiness; + +@Readiness +@ApplicationScoped +public class SimpleReadinessCheck implements HealthCheck { + + @Override + public HealthCheckResponse call() { + + return HealthCheckResponse.up("Automation Service is ready"); + } +} diff --git a/src/automation/src/main/resources/application.yaml b/src/automation/src/main/resources/application.yaml index 2ea1ef12a279b6e94ab7aa2eff1dacb7020c7ac2..8d5ae6ed513f7d20227b217fd803c809c4f5b2c4 100644 --- a/src/automation/src/main/resources/application.yaml +++ b/src/automation/src/main/resources/application.yaml @@ -38,5 +38,5 @@ quarkus: container-port: 9999 env: vars: - context-service-host: context - device-service-host: device \ No newline at end of file + context-service-host: ContextService + device-service-host: DeviceService \ No newline at end of file diff --git a/src/automation/target/kubernetes/kubernetes.yml b/src/automation/target/kubernetes/kubernetes.yml index 51af1ccf1c1eb02d23adbe2954d3cd812704cc45..73d19dc1f9e0c6f12b7d660dde71927dda7c07cc 100644 --- a/src/automation/target/kubernetes/kubernetes.yml +++ b/src/automation/target/kubernetes/kubernetes.yml @@ -3,8 +3,8 @@ apiVersion: v1 kind: Service metadata: annotations: - app.quarkus.io/commit-id: 43db942bd5641ae293df75b65cd1eefd40b8085e - app.quarkus.io/build-timestamp: 2021-11-17 - 06:42:01 +0000 + app.quarkus.io/commit-id: 6b96f471f66e6bb59357856c635f8d7e1ce98a5c + app.quarkus.io/build-timestamp: 2021-11-19 - 15:03:07 +0000 labels: app.kubernetes.io/name: automationservice app.kubernetes.io/version: 0.0.1 @@ -27,8 +27,8 @@ apiVersion: apps/v1 kind: Deployment metadata: annotations: - app.quarkus.io/commit-id: 43db942bd5641ae293df75b65cd1eefd40b8085e - app.quarkus.io/build-timestamp: 2021-11-17 - 06:42:01 +0000 + app.quarkus.io/commit-id: 6b96f471f66e6bb59357856c635f8d7e1ce98a5c + app.quarkus.io/build-timestamp: 2021-11-19 - 15:03:07 +0000 labels: app: automationservice app.kubernetes.io/name: automationservice @@ -43,8 +43,8 @@ spec: template: metadata: annotations: - app.quarkus.io/commit-id: 43db942bd5641ae293df75b65cd1eefd40b8085e - app.quarkus.io/build-timestamp: 2021-11-17 - 06:42:01 +0000 + app.quarkus.io/commit-id: 6b96f471f66e6bb59357856c635f8d7e1ce98a5c + app.quarkus.io/build-timestamp: 2021-11-19 - 15:03:07 +0000 labels: app: automationservice app.kubernetes.io/name: automationservice @@ -56,10 +56,10 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace - - name: CONTEXT_SERVICE_HOST - value: context - name: DEVICE_SERVICE_HOST - value: device + value: DeviceService + - name: CONTEXT_SERVICE_HOST + value: ContextService image: registry.gitlab.com/teraflow-h2020/controller/automation:0.0.1 imagePullPolicy: Always livenessProbe: