StompMQConnector

Class for management of Stomp MQ connections, e.g. RabbitMQ

class DIRAC.Resources.MessageQueue.StompMQConnector.StompMQConnector(parameters=None)

Bases: DIRAC.Resources.MessageQueue.MQConnector.MQConnector

Class for management of message queue connections Allows to both send and receive messages from a queue

PORT = 61613
RECONNECT_ATTEMPTS_MAX = 10000.0
RECONNECT_SLEEP_INCREASE = 0.5
RECONNECT_SLEEP_INITIAL = 1
RECONNECT_SLEEP_JITTER = 0.1
RECONNECT_SLEEP_MAX = 120
__init__(parameters=None)

Standard constructor

connect(parameters=None)
Parameters:parameters (dict) – dictionary with additional parameters if any
Returns:S_OK/S_ERROR
disconnect(parameters=None)

Disconnects from the message queue server

put(message, parameters=None)

Sends a message to the queue message contains the body of the message

Parameters:
  • message (str) – string or any json encodable structure.
  • parameters (dict) – parameters with ‘destination’ key defined.
reconnect()
setupConnection(parameters=None)
Establishes a new connection to a Stomp server, e.g. RabbitMQ
Parameters:parameters (dict) – dictionary with additional MQ parameters if any.
Returns:S_OK/S_ERROR
subscribe(parameters=None)

Subscribes to the message queue server :param dict parameters: dictionary with additional parameters if any :return: S_OK/S_ERROR

unsubscribe(parameters)

Subscribes to the message queue server :param dict parameters: dictionary with additional parameters if any :return: S_OK/S_ERROR