diff --git a/MAC/Services/src/observation_control_rpc.py b/MAC/Services/src/observation_control_rpc.py index 58fc05a1440a1ebb6fbef05ebfa7237651ce5364..168823acd437cf7cc7c56c3f49bb2e9dbecdfb56 100644 --- a/MAC/Services/src/observation_control_rpc.py +++ b/MAC/Services/src/observation_control_rpc.py @@ -20,7 +20,8 @@ import logging -from lofar.messaging.rpc import RPCClient, RPCClientContextManagerMixin +from lofar.messaging import RPCClient, RPCClientContextManagerMixin, DEFAULT_BUSNAME, \ + DEFAULT_BROKER, DEFAULT_RPC_TIMEOUT from lofar.mac.config import DEFAULT_OBSERVATION_CONTROL_SERVICE_NAME ''' Simple RPC client for Service ObservationControl2 @@ -34,5 +35,12 @@ class ObservationControlRPCClient(RPCClientContextManagerMixin): super().__init__() self._rpc_client = rpc_client + @staticmethod + def create(exchange=DEFAULT_BUSNAME, broker=DEFAULT_BROKER, timeout=DEFAULT_RPC_TIMEOUT): + """Create a OTDBRPC connecting to the given exchange/broker on the default DEFAULT_OTDB_SERVICENAME service""" + return ObservationControlRPCClient( + RPCClient(service_name=DEFAULT_OBSERVATION_CONTROL_SERVICE_NAME, + exchange=exchange, broker=broker, timeout=timeout)) + def abort_observation(self, sas_id): return self._rpc_client.execute('AbortObservation', sas_id=sas_id)