summaryrefslogtreecommitdiffstats
path: root/participant/participant-intermediary/src
diff options
context:
space:
mode:
Diffstat (limited to 'participant/participant-intermediary/src')
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java38
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java13
2 files changed, 33 insertions, 18 deletions
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java
index 67814a4e6..11f277885 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2022 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,6 +21,7 @@
package org.onap.policy.clamp.acm.participant.intermediary.comm;
+import io.micrometer.core.annotation.Timed;
import java.util.List;
import javax.ws.rs.core.Response.Status;
import org.onap.policy.clamp.acm.participant.intermediary.handler.Publisher;
@@ -67,10 +68,9 @@ public class ParticipantMessagePublisher implements Publisher {
*
* @param participantStatus the Participant Status
*/
+ @Timed(value = "publisher.participant_status", description = "PARTICIPANT_STATUS messages published")
public void sendParticipantStatus(final ParticipantStatus participantStatus) {
- if (!active) {
- throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
- }
+ validate();
topicSinkClient.send(participantStatus);
LOGGER.debug("Sent Participant Status message to CLAMP - {}", participantStatus);
}
@@ -80,10 +80,9 @@ public class ParticipantMessagePublisher implements Publisher {
*
* @param participantRegister the Participant Status
*/
+ @Timed(value = "publisher.participant_register", description = "PARTICIPANT_REGISTER messages published")
public void sendParticipantRegister(final ParticipantRegister participantRegister) {
- if (!active) {
- throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
- }
+ validate();
topicSinkClient.send(participantRegister);
LOGGER.debug("Sent Participant Register message to CLAMP - {}", participantRegister);
}
@@ -93,10 +92,9 @@ public class ParticipantMessagePublisher implements Publisher {
*
* @param participantDeregister the Participant Status
*/
+ @Timed(value = "publisher.participant_deregister", description = "PARTICIPANT_DEREGISTER messages published")
public void sendParticipantDeregister(final ParticipantDeregister participantDeregister) {
- if (!active) {
- throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
- }
+ validate();
topicSinkClient.send(participantDeregister);
LOGGER.debug("Sent Participant Deregister message to CLAMP - {}", participantDeregister);
}
@@ -106,10 +104,9 @@ public class ParticipantMessagePublisher implements Publisher {
*
* @param participantUpdateAck the Participant Update Ack
*/
+ @Timed(value = "publisher.participant_update_ack", description = "PARTICIPANT_UPDATE_ACK messages published")
public void sendParticipantUpdateAck(final ParticipantUpdateAck participantUpdateAck) {
- if (!active) {
- throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
- }
+ validate();
topicSinkClient.send(participantUpdateAck);
LOGGER.debug("Sent Participant Update Ack message to CLAMP - {}", participantUpdateAck);
}
@@ -119,10 +116,10 @@ public class ParticipantMessagePublisher implements Publisher {
*
* @param automationCompositionAck AutomationComposition Update/StateChange Ack
*/
+ @Timed(value = "publisher.automation_composition_update_ack",
+ description = "AUTOMATION_COMPOSITION_UPDATE_ACK/AUTOMATION_COMPOSITION_STATECHANGE_ACK messages published")
public void sendAutomationCompositionAck(final AutomationCompositionAck automationCompositionAck) {
- if (!active) {
- throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
- }
+ validate();
topicSinkClient.send(automationCompositionAck);
LOGGER.debug("Sent AutomationComposition Update/StateChange Ack to runtime - {}", automationCompositionAck);
}
@@ -132,12 +129,17 @@ public class ParticipantMessagePublisher implements Publisher {
*
* @param participantStatus the Participant Status
*/
+ @Timed(value = "publisher.participant_status", description = "PARTICIPANT_STATUS messages published")
public void sendHeartbeat(final ParticipantStatus participantStatus) {
+ validate();
+ topicSinkClient.send(participantStatus);
+ LOGGER.debug("Sent Participant heartbeat to CLAMP - {}", participantStatus);
+ }
+
+ private void validate() {
if (!active) {
throw new AutomationCompositionRuntimeException(Status.NOT_ACCEPTABLE, NOT_ACTIVE_TEXT);
}
- topicSinkClient.send(participantStatus);
- LOGGER.debug("Sent Participant heartbeat to CLAMP - {}", participantStatus);
}
@Override
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
index 3362f10d3..d29186844 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
@@ -22,6 +22,7 @@
package org.onap.policy.clamp.acm.participant.intermediary.handler;
+import io.micrometer.core.annotation.Timed;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -99,6 +100,8 @@ public class ParticipantHandler {
*
* @param participantStatusReqMsg participant participantStatusReq message
*/
+ @Timed(value = "listener.participant_status_req",
+ description = "PARTICIPANT_STATUS_REQ messages received")
public void handleParticipantStatusReq(final ParticipantStatusReq participantStatusReqMsg) {
var participantStatus = makeHeartbeat(true);
publisher.sendParticipantStatus(participantStatus);
@@ -109,6 +112,8 @@ public class ParticipantHandler {
*
* @param updateMsg the update message
*/
+ @Timed(value = "listener.automation_composition_update",
+ description = "AUTOMATION_COMPOSITION_UPDATE messages received")
public void handleAutomationCompositionUpdate(AutomationCompositionUpdate updateMsg) {
automationCompositionHandler.handleAutomationCompositionUpdate(updateMsg, acElementDefsOnThisParticipant);
}
@@ -118,6 +123,8 @@ public class ParticipantHandler {
*
* @param stateChangeMsg the state change message
*/
+ @Timed(value = "listener.automation_composition_state_change",
+ description = "AUTOMATION_COMPOSITION_STATE_CHANGE messages received")
public void handleAutomationCompositionStateChange(AutomationCompositionStateChange stateChangeMsg) {
automationCompositionHandler.handleAutomationCompositionStateChange(stateChangeMsg,
acElementDefsOnThisParticipant);
@@ -223,6 +230,8 @@ public class ParticipantHandler {
*
* @param participantRegisterAckMsg the participantRegisterAck message
*/
+ @Timed(value = "listener.participant_register_ack",
+ description = "PARTICIPANT_REGISTER_ACK messages received")
public void handleParticipantRegisterAck(ParticipantRegisterAck participantRegisterAckMsg) {
LOGGER.debug("ParticipantRegisterAck message received as responseTo {}",
participantRegisterAckMsg.getResponseTo());
@@ -257,6 +266,8 @@ public class ParticipantHandler {
*
* @param participantDeregisterAckMsg the participantDeregisterAck message
*/
+ @Timed(value = "listener.participant_deregister_ack",
+ description = "PARTICIPANT_DEREGISTER_ACK messages received")
public void handleParticipantDeregisterAck(ParticipantDeregisterAck participantDeregisterAckMsg) {
LOGGER.debug("ParticipantDeregisterAck message received as responseTo {}",
participantDeregisterAckMsg.getResponseTo());
@@ -267,6 +278,8 @@ public class ParticipantHandler {
*
* @param participantUpdateMsg the ParticipantUpdate message
*/
+ @Timed(value = "listener.participant_update",
+ description = "PARTICIPANT_UPDATE messages received")
public void handleParticipantUpdate(ParticipantUpdate participantUpdateMsg) {
LOGGER.debug("ParticipantUpdate message received for participantId {}",
participantUpdateMsg.getParticipantId());