From f5586edf6bb68016b4259829b57ca7e3528b126a Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Tue, 9 Apr 2019 08:34:45 -0400 Subject: Add more logging to message dispatcher Change-Id: I889cb9397b4b834ab273ec8f8ddc1af2b3c3c05e Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn --- .../common/endpoints/listeners/RequestIdDispatcher.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'policy-endpoints/src/main/java/org/onap') diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/listeners/RequestIdDispatcher.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/listeners/RequestIdDispatcher.java index 9ba73c9b..fcf9c9a9 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/listeners/RequestIdDispatcher.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/listeners/RequestIdDispatcher.java @@ -116,13 +116,17 @@ public class RequestIdDispatcher extends ScoListener { // dispatch the message if (Strings.isNullOrEmpty(reqid)) { // it's an autonomous message - offer it to all autonomous listeners + if (listeners.isEmpty()) { + logger.info("no listeners for autonomous message of type {}", message.getClass().getSimpleName()); + } + for (TypedMessageListener listener : listeners) { - offerToListener(infra, topic, message, listener); + offerToListener(infra, topic, message, reqid, listener); } } else { // it's a response to a particular request - offerToListener(infra, topic, message, req2listener.get(reqid)); + offerToListener(infra, topic, message, reqid, req2listener.get(reqid)); } } @@ -132,11 +136,14 @@ public class RequestIdDispatcher extends ScoListener { * @param infra infrastructure on which the message was received * @param topic topic on which the message was received * @param msg message that was received + * @param reqid request id extracted from the message * @param listener listener to which the message should be offered, or {@code null} */ - private void offerToListener(CommInfrastructure infra, String topic, T msg, TypedMessageListener listener) { + private void offerToListener(CommInfrastructure infra, String topic, T msg, String reqid, + TypedMessageListener listener) { if (listener == null) { + logger.info("no listener for request id {}", reqid); return; } -- cgit 1.2.3-korg