summaryrefslogtreecommitdiffstats
path: root/components/pm-subscription-handler/pmsh_service/pmsh_service_main.py
diff options
context:
space:
mode:
Diffstat (limited to 'components/pm-subscription-handler/pmsh_service/pmsh_service_main.py')
-rwxr-xr-xcomponents/pm-subscription-handler/pmsh_service/pmsh_service_main.py22
1 files changed, 6 insertions, 16 deletions
diff --git a/components/pm-subscription-handler/pmsh_service/pmsh_service_main.py b/components/pm-subscription-handler/pmsh_service/pmsh_service_main.py
index 1af01cf1..1d8b0b34 100755
--- a/components/pm-subscription-handler/pmsh_service/pmsh_service_main.py
+++ b/components/pm-subscription-handler/pmsh_service/pmsh_service_main.py
@@ -1,5 +1,5 @@
# ============LICENSE_START===================================================
-# Copyright (C) 2019-2021 Nordix Foundation.
+# Copyright (C) 2019-2022 Nordix Foundation.
# ============================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,10 +20,9 @@ from signal import signal, SIGTERM
from mod.aai_event_handler import AAIEventHandler
from mod import db, create_app, launch_api_server, logger
from mod.exit_handler import ExitHandler
-from mod.pmsh_config import AppConfig as NewAppConfig
-from mod.pmsh_utils import AppConfig, PeriodicTask
+from mod.pmsh_config import AppConfig
+from mod.pmsh_utils import PeriodicTask
from mod.policy_response_handler import PolicyResponseHandler
-from mod.subscription_handler import SubscriptionHandler
def main():
@@ -32,10 +31,7 @@ def main():
app = create_app()
app.app_context().push()
db.create_all(app=app)
- app_conf = AppConfig()
- pmsh_app_conf = NewAppConfig()
- policy_mr_pub = app_conf.get_mr_pub('policy_pm_publisher')
- aai_event_mr_sub = app_conf.get_mr_sub('aai_subscriber')
+ pmsh_app_conf = AppConfig()
except Exception as e:
logger.error(f'Failed to get config and create application: {e}', exc_info=True)
sys.exit(e)
@@ -46,20 +42,14 @@ def main():
logger.info('Start polling PMSH_CL_INPUT topic on DMaaP MR.')
policy_response_handler_thread.start()
- subscription_handler = SubscriptionHandler(policy_mr_pub, aai_event_mr_sub, app, app_conf)
- subscription_handler_thread = PeriodicTask(20, subscription_handler.execute)
- subscription_handler_thread.name = 'sub_handler_thread'
- subscription_handler_thread.start()
-
aai_event_handler = AAIEventHandler(app)
aai_event_handler_thread = PeriodicTask(20, aai_event_handler.execute)
aai_event_handler_thread.name = 'aai_event_thread'
aai_event_handler_thread.start()
- periodic_tasks = [subscription_handler_thread, policy_response_handler_thread,
+ periodic_tasks = [policy_response_handler_thread,
aai_event_handler_thread]
- signal(SIGTERM, ExitHandler(periodic_tasks=periodic_tasks,
- app_conf=app_conf, subscription_handler=subscription_handler))
+ signal(SIGTERM, ExitHandler(periodic_tasks=periodic_tasks))
launch_api_server(pmsh_app_conf)
except Exception as e: