Utilities

Utilities for the MessageQueue package

DIRAC.Resources.MessageQueue.Utilities.generateDefaultCallback()
Function generates a default callback that can

be used to handle the messages in the MQConsumer clients. It contains the internal queue (as closure) for the incoming messages. The queue can be accessed by the callback.get() method. The callback.get() method returns the first message or raise the exception Queue.Empty. e.g. myCallback = generateDefaultCallback()

try:

print myCallback.get()

except Queue.Empty:

pass

Parameters:

mqURI (str) – Pseudo URI identifing MQ connection. It has the following format mqConnection::DestinationType::DestinationName e.g. blabla.cern.ch::Queues::MyQueue1

Returns:

callback function

Return type:

object

DIRAC.Resources.MessageQueue.Utilities.getDestinationAddress(mqURI)
DIRAC.Resources.MessageQueue.Utilities.getDestinationName(mqURI)
DIRAC.Resources.MessageQueue.Utilities.getDestinationType(mqURI)
DIRAC.Resources.MessageQueue.Utilities.getMQParamsFromCS(mqURI)

Function gets parameters of a MQ destination (queue/topic) from the CS.

Parameters:
  • mqURI (str) – Pseudo URI identifing the MQ service. It has the following format: mqConnection::DestinationType::DestinationName e.g. blabla.cern.ch::Queues::MyQueue1

  • mType (str) – ‘consumer’ or ‘producer’

Returns:

S_OK(param_dicts) or S_ERROR

DIRAC.Resources.MessageQueue.Utilities.getMQService(mqURI)