fix for: consuming from response_topic, differantiate as per message type

Issue-ID: NONRTRIC-757
Change-Id: I0639ded4d876dae728cd82644eeea37d14ca8f3a
Signed-off-by: halil.cakal <halil.cakal@est.tech>
diff --git a/near-rt-ric-simulator/test/KAFKA_DISPATCHER/src/dispatcher.py b/near-rt-ric-simulator/test/KAFKA_DISPATCHER/src/dispatcher.py
index 08a4eed..2283d09 100644
--- a/near-rt-ric-simulator/test/KAFKA_DISPATCHER/src/dispatcher.py
+++ b/near-rt-ric-simulator/test/KAFKA_DISPATCHER/src/dispatcher.py
@@ -174,8 +174,18 @@
 
       print("Consumer Record:", consumer_record)
       cons_rec_value = consumer_record.value
-      cons_rec_val_in_dict = json.loads(cons_rec_value)
-      resp_code = cons_rec_val_in_dict['response-code']
+      print('Class for cons_rec_value:', cons_rec_value.__class__)
+      if isinstance(cons_rec_value, str):
+        print('cons_rec_value isinstance str')
+        cons_rec_val_in_dict = json.loads(cons_rec_value) # json.loads: converts str to dict
+        resp_code = cons_rec_val_in_dict['response-code']
+      elif isinstance(cons_rec_value, dict):
+        print('cons_rec_value isinstance dict')
+        resp_code = cons_rec_value['response-code']
+      else:
+        print('cons_rec_value isinstance other')
+        cons_rec_val_in_dict = json.loads(cons_rec_value)
+        resp_code = cons_rec_val_in_dict['response-code']
 
       # if response code success, then check for time-out
       if (int(resp_code) == 200):
diff --git a/near-rt-ric-simulator/test/STD_2.0.0/build_and_start_with_kafka.sh b/near-rt-ric-simulator/test/STD_2.0.0/build_and_start_with_kafka.sh
index eae4e37..b12ecf7 100755
--- a/near-rt-ric-simulator/test/STD_2.0.0/build_and_start_with_kafka.sh
+++ b/near-rt-ric-simulator/test/STD_2.0.0/build_and_start_with_kafka.sh
@@ -98,5 +98,6 @@
     docker run -d --network host --rm -it -p 7075:7075 -p 7175:7175 -e ALLOW_HTTP=true -e MSG_BROKER_URL=localhost:9092 -e TIME_OUT=30 $PUBLISH_RESP --volume "$dirkafkasrv/certificate:/usr/src/app/cert" --name kafkamessagedispatcher kafka_dispatcher
 fi
 
-# Runs A1 simulator
-docker run --network host --rm -it -p 8085:8085 -p 8185:8185 -e A1_VERSION=STD_2.0.0 -e ALLOW_HTTP=true -e REMOTE_HOSTS_LOGGING=1 -e DUPLICATE_CHECK=$DUP_CHECK $URL_FLAG --volume "$dirnrtsim/certificate:/usr/src/app/cert" --name a1StdSimulator a1test
+# Runs A1 simulator in detached mode
+# In order to tail logs use:: docker logs -f a1StdSimulator
+docker run -d --network host --rm -it -p 8085:8085 -p 8185:8185 -e A1_VERSION=STD_2.0.0 -e ALLOW_HTTP=true -e REMOTE_HOSTS_LOGGING=1 -e DUPLICATE_CHECK=$DUP_CHECK $URL_FLAG --volume "$dirnrtsim/certificate:/usr/src/app/cert" --name a1StdSimulator a1test