aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/main/java/org/onap/policy/pap/main/comm/PdpHeartbeatListener.java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-06-16 17:52:17 -0400
committerJim Hahn <jrh3@att.com>2020-06-17 14:41:01 -0400
commit5cfff2b468a13e7b5ce068e58e899fcfe36537b3 (patch)
tree95a3f9f64443cb7028afa90632bd412048ed05a0 /main/src/main/java/org/onap/policy/pap/main/comm/PdpHeartbeatListener.java
parent169dd4b89bb02a4a644b748a07a0294a324715cb (diff)
PAP should discard old PDP messages
Modified PAP to discard any messages old than 10 minutes so that if PAP is unable to communicate with DMaaP and then suddently gets flooded, it will discard old messages. Updates per review comments - made the "max message age" configurable, with a default of 10 minutes Issue-ID: POLICY-2170 Change-Id: I541c03aabf29482af12a07f51eeb5888bbafbf31 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'main/src/main/java/org/onap/policy/pap/main/comm/PdpHeartbeatListener.java')
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/comm/PdpHeartbeatListener.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/comm/PdpHeartbeatListener.java b/main/src/main/java/org/onap/policy/pap/main/comm/PdpHeartbeatListener.java
index fc61c1ab..512609a4 100644
--- a/main/src/main/java/org/onap/policy/pap/main/comm/PdpHeartbeatListener.java
+++ b/main/src/main/java/org/onap/policy/pap/main/comm/PdpHeartbeatListener.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@ package org.onap.policy.pap.main.comm;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.TypedMessageListener;
import org.onap.policy.models.pdp.concepts.PdpStatus;
+import org.onap.policy.pap.main.parameters.PdpParameters;
/**
* Listener for PDP Status messages which either represent registration or heart beat.
@@ -31,10 +33,21 @@ import org.onap.policy.models.pdp.concepts.PdpStatus;
*/
public class PdpHeartbeatListener implements TypedMessageListener<PdpStatus> {
+ private final PdpParameters params;
+
+ /**
+ * Constructs the object.
+ *
+ * @param params PDP parameters
+ */
+ public PdpHeartbeatListener(PdpParameters params) {
+ this.params = params;
+ }
+
@Override
public void onTopicEvent(final CommInfrastructure infra, final String topic, final PdpStatus message) {
- final PdpStatusMessageHandler handler = new PdpStatusMessageHandler();
+ final PdpStatusMessageHandler handler = new PdpStatusMessageHandler(params);
handler.handlePdpStatus(message);
}
}