diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/config.py b/SAS/ResourceAssignment/ResourceAssignmentDatabase/config.py index d8a6964dc6055fc9e1f874060b6f02c01d2645c1..dabf0b2a3750874a7bf3199675def744ea418f4c 100644 --- a/SAS/ResourceAssignment/ResourceAssignmentDatabase/config.py +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/config.py @@ -1,5 +1,6 @@ #!/usr/bin/python # $Id$ -DEFAULT_BUSNAME = 'lofar.ra.notification' -DEFAULT_NOTIFICATION_SUBJECT_PREFIX = 'RADB.' +DEFAULT_NOTIFICATION_BUSNAME = 'lofar.ra.notification' +DEFAULT_NOTIFICATION_PREFIX = 'RADB.' +DEFAULT_NOTIFICATION_SUBJECTS=DEFAULT_NOTIFICATION_PREFIX+'*' diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbbuslistener.py b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbbuslistener.py index 627e05ab3116365d0ef035fb9147c690262b4919..0939c4e98c07be7982b6768573cfcf75d56a5b62 100644 --- a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbbuslistener.py +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbbuslistener.py @@ -28,7 +28,7 @@ Typical usage is to derive your own subclass from RADBBusListener and implement """ from lofar.messaging.messagebus import AbstractBusListener -from lofar.sas.resourceassignment.database.config import DEFAULT_BUSNAME +from lofar.sas.resourceassignment.database.config import DEFAULT_NOTIFICATION_BUSNAME, DEFAULT_NOTIFICATION_SUBJECTS from lofar.common.util import waitForInterrupt import qpid.messaging @@ -39,7 +39,7 @@ logger = logging.getLogger(__name__) class RADBBusListener(AbstractBusListener): - def __init__(self, busname=DEFAULT_BUSNAME, subject='RADB.*', broker=None, **kwargs): + def __init__(self, busname=DEFAULT_NOTIFICATION_BUSNAME, subject=DEFAULT_NOTIFICATION_SUBJECTS, broker=None, **kwargs): """ RADBBusListener listens on the lofar notification message bus and calls (empty) on<SomeMessage> methods when such a message is received. Typical usage is to derive your own subclass from RADBBusListener and implement the specific on<SomeMessage> methods that you are interested in. diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbpglistener.py b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbpglistener.py index b94781cb09ffe43d52791ab45ac515922b11cfa9..884344c7e7e7128da2c6902fda4a647a2c81f5ff 100644 --- a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbpglistener.py +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbpglistener.py @@ -32,15 +32,15 @@ from optparse import OptionParser from lofar.common.postgres import PostgresListener, makePostgresNotificationQueries from lofar.messaging import EventMessage, ToBus -from lofar.sas.resourceassignment.database.config import DEFAULT_BUSNAME, DEFAULT_NOTIFICATION_SUBJECT_PREFIX +from lofar.sas.resourceassignment.database.config import DEFAULT_NOTIFICATION_BUSNAME, DEFAULT_NOTIFICATION_PREFIX from lofar.common import dbcredentials logger = logging.getLogger(__name__) class RADBPGListener(PostgresListener): def __init__(self, - busname=DEFAULT_BUSNAME, - notification_prefix=DEFAULT_NOTIFICATION_SUBJECT_PREFIX, + busname=DEFAULT_NOTIFICATION_BUSNAME, + notification_prefix=DEFAULT_NOTIFICATION_PREFIX, dbcreds=None, broker=None): super(RADBPGListener, self).__init__(dbcreds.host, dbcreds.database, dbcreds.user, dbcreds.password) @@ -140,8 +140,8 @@ def main(): parser = OptionParser("%prog [options]", description='runs the radb postgres listener which listens to changes on some tables in the radb and publishes the changes as notifications on the bus.') parser.add_option('-q', '--broker', dest='broker', type='string', default=None, help='Address of the qpid broker, default: localhost') - parser.add_option("-b", "--busname", dest="busname", type="string", default=DEFAULT_BUSNAME, help="Name of the publication bus on the qpid broker, [default: %default]") - parser.add_option("-n", "--notification_prefix", dest="notification_prefix", type="string", default=DEFAULT_NOTIFICATION_SUBJECT_PREFIX, help="The prefix for all notifications of this publisher, [default: %default]") + parser.add_option("-b", "--busname", dest="busname", type="string", default=DEFAULT_NOTIFICATION_BUSNAME, help="Name of the publication bus on the qpid broker, [default: %default]") + parser.add_option("-n", "--notification_prefix", dest="notification_prefix", type="string", default=DEFAULT_NOTIFICATION_PREFIX, help="The prefix for all notifications of this publisher, [default: %default]") parser.add_option_group(dbcredentials.options_group(parser)) parser.set_defaults(dbcredentials="RADB") (options, args) = parser.parse_args()