Add more logging to message dispatcher 74/84674/1
authorJim Hahn <jrh3@att.com>
Tue, 9 Apr 2019 12:34:45 +0000 (08:34 -0400)
committerJim Hahn <jrh3@att.com>
Tue, 9 Apr 2019 12:36:36 +0000 (08:36 -0400)
Change-Id: I889cb9397b4b834ab273ec8f8ddc1af2b3c3c05e
Issue-ID: POLICY-1542
Signed-off-by: Jim Hahn <jrh3@att.com>
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/listeners/RequestIdDispatcher.java

index 9ba73c9..fcf9c9a 100644 (file)
@@ -116,13 +116,17 @@ public class RequestIdDispatcher<T> extends ScoListener<T> {
         // 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<T> 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<T> extends ScoListener<T> {
      * @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<T> listener) {
+    private void offerToListener(CommInfrastructure infra, String topic, T msg, String reqid,
+                    TypedMessageListener<T> listener) {
 
         if (listener == null) {
+            logger.info("no listener for request id {}", reqid);
             return;
         }