Queue - abstraction of a message queue
Example:
import messaging.queue as queue
mq = queue.new({"type":"Foo", ... options ...});
# is identical too
mq = queue.foo.Foo(... options ...);
This module provides an abstraction of a message queue. Its only purpose is to offer a unified method to create a new queue. The functionality is implemented in child modules such as messaging.queue.dqs.DQS.
Copyright (C) 2013 CERN
Create a new message queue object; options must contain the type of queue (which is the name of the child class), see above.
DQN - abstraction of a dirq.queue.Queue message queue.
Example:
from messaging.message import Message
from messaging.queue.dqn import DQN
# create a message queue
mq = DQN(path = "/some/where")
# add a message to the queue
msg = Message(body="hello world")
print("msg added as %s" % mq.add_message(msg))
# browse the queue
for name in mq:
if mq.lock(name):
msg = mq.get_message(name)
# unlock the element
mq.unlock(name)
# othwerwise, if you want to remove the element
# mq.remove(name)
This module provides an abstraction of a message queue. It derives from the dirq.queue.Queue module that provides a generic directory-based queue.
It uses the following dirq.queue.Queue schema to store a message:
schema = {
"header" = "table",
"binary" = "binary?",
"text" = "string?",
}
The message header is therefore stored as a table and the message body is stored either as a text or binary string.
Copyright (C) 2013 CERN
Abstraction of a Normal Queue message queue.
Add the given message (a messaging.message.Message object) to the queue and return the corresponding element name.
Dequeue the message from the given element and return a messaging.message.Message object.
Get the message from the given element (which must be locked) and return a messaging.message.Message object.
DQS - abstraction of a dirq.QueueSimple.QueueSimple message queue.
Example:
from messaging.message import Message
from messaging.queue.dqs import DQS
# create a message queue
mq = DQS(path = "/some/where")
# add a message to the queue
msg = Message(body = "hello world")
print("msg added as %s" % mq.add_message(msg))
# browse the queue
for name in mq:
if mq.lock(name):
msg = mq.get_message(name)
# unlock the element
mq.unlock(name)
# othwerwise, if you want to remove the element
# mq.remove(name)
This module provides an abstraction of a message queue. It derives from the dirq.QueueSimple.QueueSimple module that provides a generic directory-based queue.
It simply stores the serialized message (with optional compression) as a dirq.QueueSimple.QueueSimple element.
Copyright (C) 2013 CERN
Abstraction of a dirq.QueueSimple.QueueSimple message queue.
Add the given message (a messaging.message.Message object) to the queue and return the corresponding element name.
Dequeue the message from the given element and return a messaging.message.Message object.