Fix for Bug 1433 Exception handling in aioread method
Change-Id: I39e2c888798dd518a9ad71e3cbd41be9241dd579
Signed-off-by: palsus <subhankar.pal@aricent.com>
diff --git a/osm_mon/cmd/mon_utils.py b/osm_mon/cmd/mon_utils.py
index 5b62d6c..6d383d0 100644
--- a/osm_mon/cmd/mon_utils.py
+++ b/osm_mon/cmd/mon_utils.py
@@ -19,7 +19,7 @@
import socket
import logging
import kafka
-
+from osm_mon.core.message_bus_client import MessageBusClient
def wait_till_commondb_is_ready(config, process_name="osm-mon", commondb_wait_time=5):
@@ -61,6 +61,14 @@
.get("port")])
topics = consumer.topics()
logging.debug("Number of topics found: %s", len(topics))
+
+ # Send dummy message in kafka topics. If kafka is not ready exception will be thrown.
+ msg_bus = MessageBusClient(config)
+ topics = ["alarm_request", "users", "project"]
+ for topic in topics:
+ msg_bus.aiowrite(topic, 'echo', 'dummy message')
+
+ # Kafka is ready now
kafka_ready = True
except Exception as e:
logging.info("Error when trying to get kafka status.")