diff options
author | Patrick Brady <patrick.brady@att.com> | 2019-11-14 14:17:04 -0800 |
---|---|---|
committer | Patrick Brady <patrick.brady@att.com> | 2019-11-14 22:18:40 +0000 |
commit | d37a45ab352084738b3f95cb64cc83d4e1484d0b (patch) | |
tree | 2d79eccb8ad852af8ae156b57231d8d777eac819 | |
parent | 08a64bdc7db020e4e928f194ed8dd0059627b1aa (diff) |
Add additional error messages to dmaap service
Add error checking and logging if required properties
are not present.
Change-Id: I270a7a088e36de603b89133e9ccb22f206e931e4
Signed-off-by: Patrick Brady <patrick.brady@att.com>
Issue-ID: APPC-1744
-rw-r--r-- | services/appc-dmaap-service/appc-dmaap-event-service/src/main/java/org/onap/appc/services/dmaapService/PublishService.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/services/appc-dmaap-service/appc-dmaap-event-service/src/main/java/org/onap/appc/services/dmaapService/PublishService.java b/services/appc-dmaap-service/appc-dmaap-event-service/src/main/java/org/onap/appc/services/dmaapService/PublishService.java index 1e1b9e7f8..cc20539f4 100644 --- a/services/appc-dmaap-service/appc-dmaap-event-service/src/main/java/org/onap/appc/services/dmaapService/PublishService.java +++ b/services/appc-dmaap-service/appc-dmaap-event-service/src/main/java/org/onap/appc/services/dmaapService/PublishService.java @@ -30,6 +30,10 @@ import org.onap.appc.adapter.factory.DmaapMessageAdapterFactoryImpl; import org.onap.appc.configuration.Configuration; import org.onap.appc.configuration.ConfigurationFactory; import org.springframework.stereotype.Service; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + import org.onap.appc.adapter.message.MessageAdapterFactory; import org.onap.appc.adapter.message.Producer; import org.onap.appc.adapter.messaging.dmaap.http.HttpDmaapProducerImpl; @@ -37,6 +41,8 @@ import org.onap.appc.adapter.messaging.dmaap.http.HttpDmaapProducerImpl; @Service public class PublishService { + private static final EELFLogger LOG = EELFManager.getInstance().getLogger(PublishService.class); + private Map<String,Producer> producers; private MessageAdapterFactory factory; Configuration configuration; @@ -101,6 +107,14 @@ public class PublishService { pool.add(name); } } + if(pool.isEmpty()) { + LOG.error("There are no dmaap server pools. Check the property " + key + ".poolMembers"); + return null; + } + if(writeTopic == null || writeTopic.isEmpty()) { + LOG.error("There is no write topic defined in the message request or in the properties file"); + return null; + } return factory.createProducer(pool, writeTopic, apiKey, apiSecret); } return null; |