summaryrefslogtreecommitdiffstats
path: root/runtime-controlloop/src
diff options
context:
space:
mode:
Diffstat (limited to 'runtime-controlloop/src')
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java
index a426cac4a..dbc2c4ea6 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java
@@ -34,6 +34,8 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopInfo;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider;
import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantProvider;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopAck;
@@ -159,6 +161,22 @@ public class SupervisionHandler {
@MessageIntercept
public void handleParticipantMessage(ParticipantDeregister participantDeregisterMessage) {
LOGGER.debug("Participant Deregister received {}", participantDeregisterMessage);
+ try {
+ var participantList =
+ participantProvider.getParticipants(participantDeregisterMessage.getParticipantId().getName(),
+ participantDeregisterMessage.getParticipantId().getVersion());
+
+ if (participantList != null) {
+ for (Participant participant : participantList) {
+ participant.setParticipantState(ParticipantState.TERMINATED);
+ participant.setHealthStatus(ParticipantHealthStatus.OFF_LINE);
+ }
+ participantProvider.updateParticipants(participantList);
+ }
+ } catch (PfModelException pfme) {
+ LOGGER.warn("Model exception occured {}", participantDeregisterMessage.getParticipantId());
+ }
+
participantDeregisterAckPublisher.send(participantDeregisterMessage.getMessageId());
}