Commit 460fbdbc authored by fsoldatos's avatar fsoldatos
Browse files

feat(automation): implement readiness probe funtionality

parent 73f923be
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
# 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
+10 −1
Original line number Diff line number Diff line
@@ -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()
+1 −1
Original line number Diff line number Diff line
@@ -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");
    }
}
+17 −0
Original line number Diff line number Diff line
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");
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -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
Loading