Remove annotations in models
[policy/models.git] / models-interactions / model-simulators / src / main / java / org / onap / policy / simulators / TopicServer.java
index 0abe5f4..004a2e2 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2021 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.
@@ -43,7 +43,7 @@ public abstract class TopicServer<Q> implements TopicListener {
      * @param sink sink to which responses should be published
      * @param source source from which requests arrive
      */
-    public TopicServer(TopicSink sink, TopicSource source, Coder coder, Class<Q> reqClass) {
+    protected TopicServer(TopicSink sink, TopicSource source, Coder coder, Class<Q> reqClass) {
         this.sink = sink;
         this.source = source;
         this.coder = coder;
@@ -65,8 +65,17 @@ public abstract class TopicServer<Q> implements TopicListener {
             throw new IllegalArgumentException("cannot decode request from " + source.getTopic());
         }
 
-        sink.send(process(req));
+        String resp = process(req);
+        if (resp != null) {
+            sink.send(resp);
+        }
     }
 
+    /**
+     * Processes a request.
+     *
+     * @param request request to be processed
+     * @return the response, or {@code null} if no response is to be sent
+     */
     protected abstract String process(Q request);
 }