MQConnector

Class for management of MQ communication

exception DIRAC.Resources.MessageQueue.MQConnector.MQConnectionError

Bases: Exception

specialized exception

__init__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

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

Bases: object

Class for management of message queue connections

__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

Parameters:

parameters (dict) – dictionary with additional parameters if any

Returns:

S_OK/S_ERROR

put(message, parameters=None)

Send message to a MQ server

Parameters:

message – any json encodable structure

Returns:

S_OK/S_ERROR

setupConnection(parameters=None)
Parameters:

parameters (dict) – dictionary with additional MQ parameters if any

Returns:

S_OK/S_ERROR

subscribe(parameters=None)

Subscribes to the message queue server

Parameters:

parameters (dict) – dictionary with additional parameters if any

Returns:

S_OK/S_ERROR

unsubscribe(parameters=None)

Subscribes to the message queue server

Parameters:

parameters (dict) – dictionary with additional parameters if any

Returns:

S_OK/S_ERROR

DIRAC.Resources.MessageQueue.MQConnector.createMQConnector(parameters=None)

Function creates and returns the MQConnector object based.

Parameters:

parameters (dict) – set of parameters for the MQConnector constructor, it should also contain pair ‘MQType’:mqType, where mqType is a string used as a prefix for the specialized MQConnector class.

Returns:

with loaded specialized class of MQConnector.

Return type:

S_OK or S_ERROR

DIRAC.Resources.MessageQueue.MQConnector.getMQConnectorClass(mqType)
Function loads the specialized MQConnector class based on mqType.

It is assumed that MQConnector has a name in the format mqTypeMQConnector e.g. if StompMQConnector.

Parameters:

mqType (str) – prefix of specialized class name e.g. Stomp.

Returns:

with loaded specialized class of MQConnector.

Return type:

S_OK or S_ERROR