From a21585b6f9f8f20f11a8ad5dab847d766ee78ea0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rn=20K=C3=BCnsem=C3=B6ller?=
 <jkuensem@physik.uni-bielefeld.de>
Date: Mon, 7 Jan 2019 16:12:38 +0000
Subject: [PATCH] Task SW-539: Make ALERT broker connection configurable
 through config.py

---
 SAS/TriggerServices/lib/config.py          | 4 +++-
 SAS/TriggerServices/lib/trigger_service.py | 5 +++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/SAS/TriggerServices/lib/config.py b/SAS/TriggerServices/lib/config.py
index 99e285c75b6..83cbaa76eda 100644
--- a/SAS/TriggerServices/lib/config.py
+++ b/SAS/TriggerServices/lib/config.py
@@ -30,4 +30,6 @@ OTDB_NOTIFICATION_SUBJECT = 'TaskStatus'
 
 # VO-Events
 
-# todo
\ No newline at end of file
+ALERT_BROKER_HOST = '127.0.0.1'
+ALERT_BROKER_PORT = 8099
+ALERT_PACKET_TYPE_FILTER = None  # list of int or None for all
diff --git a/SAS/TriggerServices/lib/trigger_service.py b/SAS/TriggerServices/lib/trigger_service.py
index 73173bec04c..052312d135e 100644
--- a/SAS/TriggerServices/lib/trigger_service.py
+++ b/SAS/TriggerServices/lib/trigger_service.py
@@ -38,7 +38,8 @@ from config import MOMQUERY_BUSNAME, MOMQUERY_SERVICENAME, \
     VALIDATION_BUSNAME, VALIDATION_SERVICENAME, \
     SPECIFICATIONTRANSLATION_BUSNAME, SPECIFICATIONTRANSLATION_SERVICENAME, \
     TRIGGER_SERVICENAME, TRIGGER_BUSNAME, \
-    TRIGGER_ADDITION_NOTIFICATION_BUSNAME, TRIGGER_ADDITION_NOTIFICATION_SUBJECT
+    TRIGGER_ADDITION_NOTIFICATION_BUSNAME, TRIGGER_ADDITION_NOTIFICATION_SUBJECT, \
+    ALERT_BROKER_HOST, ALERT_BROKER_PORT, ALERT_PACKET_TYPE_FILTER
 
 
 from lofar.triggerservices.voevent_listener import VOEventListenerInterface
@@ -392,7 +393,7 @@ def main():
     with create_service():
         # handle vo events
         # todo: configure broker host/port and filter_for Package_Type integer as provided for ALERT
-        alert_handler = ALERTHandler(broker_host='127.0.0.1', broker_port=8099, filter_for=None)
+        alert_handler = ALERTHandler(broker_host=ALERT_BROKER_HOST, broker_port=ALERT_BROKER_PORT, filter_for=ALERT_PACKET_TYPE_FILTER)
         alert_handler.start_listening()
         waitForInterrupt()
 
-- 
GitLab