From 7e8397486cb1f07ff51da0dfc26c23f9717ed48c Mon Sep 17 00:00:00 2001 From: burdziak Date: Mon, 23 Apr 2018 09:12:55 +0200 Subject: Small Fixes in EventProcessor Change-Id: I545c2ab0fc46d6667b403e840bec2a1f0dde25d5 Issue-ID: DCAEGEN2-466 Signed-off-by: burdziak --- .../java/org/onap/dcae/commonFunction/EventProcessor.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/main') diff --git a/src/main/java/org/onap/dcae/commonFunction/EventProcessor.java b/src/main/java/org/onap/dcae/commonFunction/EventProcessor.java index d41cb23a..c7c052f9 100644 --- a/src/main/java/org/onap/dcae/commonFunction/EventProcessor.java +++ b/src/main/java/org/onap/dcae/commonFunction/EventProcessor.java @@ -46,7 +46,7 @@ public class EventProcessor implements Runnable { private static final String EVENT_LITERAL = "event"; private static final String COMMON_EVENT_HEADER = "commonEventHeader"; - private static HashMap streamid_hash = new HashMap(); + private static HashMap streamidHash = new HashMap<>(); public JSONObject event; public EventProcessor() { @@ -55,11 +55,11 @@ public class EventProcessor implements Runnable { String[] list = CommonStartup.streamid.split("\\|"); for (String aList : list) { String domain = aList.split("=")[0]; - // String streamIdList[] = list[i].split("=")[1].split(","); + String[] streamIdList = aList.substring(aList.indexOf('=') + 1).split(","); log.debug(String.format("Domain: %s streamIdList:%s", domain, Arrays.toString(streamIdList))); - streamid_hash.put(domain, streamIdList); + streamidHash.put(domain, streamIdList); } } @@ -70,9 +70,7 @@ public class EventProcessor implements Runnable { try { event = CommonStartup.fProcessingInputQueue.take(); - - // EventPublisher Ep=new EventPublisher(); while (event != null) { // As long as the producer is running we remove elements from // the queue. @@ -84,7 +82,7 @@ public class EventProcessor implements Runnable { log.debug("event.VESuniqueId" + event.get("VESuniqueId") + "event.commonEventHeader.domain:" + event.getJSONObject(EVENT_LITERAL).getJSONObject(COMMON_EVENT_HEADER).getString("domain")); - String[] streamIdList = streamid_hash + String[] streamIdList = streamidHash .get(event.getJSONObject(EVENT_LITERAL).getJSONObject(COMMON_EVENT_HEADER).getString("domain")); log.debug("streamIdList:" + streamIdList); @@ -94,7 +92,7 @@ public class EventProcessor implements Runnable { for (String aStreamIdList : streamIdList) { log.info("Invoking publisher for streamId:" + aStreamIdList); this.overrideEvent(); - //EventPublisher.getInstance(aStreamIdList).sendEvent(event); + EventPublisherHash.getInstance().sendEvent(event, aStreamIdList); } @@ -133,7 +131,6 @@ public class EventProcessor implements Runnable { // now convert to org.json final String jsonText = jo.toString(); final JSONArray topLevel = new JSONArray(jsonText); - // log.info("topLevel == " + topLevel); Class[] paramJSONObject = new Class[1]; paramJSONObject[0] = JSONObject.class; -- cgit 1.2.3-korg