diff options
author | PrakashH <pbhandar@techmahindra.com> | 2019-01-28 20:49:02 +0000 |
---|---|---|
committer | PrakashH <pbhandar@techmahindra.com> | 2019-01-28 20:49:02 +0000 |
commit | a86243058c2daa560aebaecdb096ff63788a6f44 (patch) | |
tree | 68d29b8ec0545792d50785b0105914d00c73d884 /miss_htbt_service/htbtworker.py | |
parent | 20110ffeb5071193e7b437e797636d9d6318dcd4 (diff) |
Heartbeat Microservice Support
Heartbeat service monitors missing HB notification
Issue-ID: DCAEGEN2-267
Change-Id: I0fd191b2a3495202e22f633ada4a1350a97557ad
Signed-off-by: PrakashH <pbhandar@techmahindra.com>
Diffstat (limited to 'miss_htbt_service/htbtworker.py')
-rw-r--r-- | miss_htbt_service/htbtworker.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/miss_htbt_service/htbtworker.py b/miss_htbt_service/htbtworker.py index 5b62943..cb7465c 100644 --- a/miss_htbt_service/htbtworker.py +++ b/miss_htbt_service/htbtworker.py @@ -44,12 +44,12 @@ def read_json_file(i): def process_msg(jsfile,user_name, password, ip_address, port_num, db_name): global mr_url i=0 - sleep_duration = 10 + sleep_duration = 20 while(True): time.sleep(sleep_duration) with open(jsfile, 'r') as outfile: cfg = json.load(outfile) - mr_url = str(cfg['streams_subscribes']['ves_heartbeat']['dmaap_info']['topic_url']) + mr_url = str(cfg['streams_subscribes']['ves-heartbeat']['dmaap_info']['topic_url']) while(True): hbc_pid, hbc_state, hbc_srcName, hbc_time = db.read_hb_common(user_name,password,ip_address,port_num,db_name) @@ -61,6 +61,7 @@ def process_msg(jsfile,user_name, password, ip_address, port_num, db_name): if(os.getenv('pytest', "") == 'test'): eventnameList = ["Heartbeat_vDNS","Heartbeat_vFW","Heartbeat_xx"] + connection_db = 0 else: connection_db = postgres_db_open(user_name, password, ip_address, port_num, db_name) cur = connection_db.cursor() @@ -72,7 +73,7 @@ def process_msg(jsfile,user_name, password, ip_address, port_num, db_name): if "groupID" not in os.environ or "consumerID" not in os.environ: get_url = mr_url + 'DefaultGroup/1?timeout=15000' else: - get_url = mr_url + os.getenv('groupID') + '/' + os.getenv('consumerID') + '?timeout=15000' + get_url = mr_url + '/' + os.getenv('groupID', "") + '/' + os.getenv('consumerID', "") + '?timeout=15000' msg="HBT:Getting :"+get_url _logger.info(msg) @@ -93,8 +94,6 @@ def process_msg(jsfile,user_name, password, ip_address, port_num, db_name): inputString = res.text #If mrstatus in message body indicates some information, not json msg. if ("mrstatus" in inputString): - if (sleep_duration < 60): - sleep_duration = sleep_duration + 10 continue jlist = inputString.split('\n'); # Process the DMaaP input message retreived @@ -243,5 +242,5 @@ if __name__ == '__main__': _logger.info("HBT:HeartBeat thread Created") msg="HBT:The config file name passed is -%s", jsfile _logger.info(msg) - ip_address, port_num, user_name, password, db_name, cbs_polling_required, cbs_polling_interval= db.read_hb_properties() + ip_address, port_num, user_name, password, db_name, cbs_polling_required, cbs_polling_interval= db.read_hb_properties(jsfile) process_msg(jsfile,user_name, password, ip_address, port_num, db_name) |