Messaging::Message::Queue::DQS - abstraction of a Directory::Queue::Simple message queue
use Messaging::Message; use Messaging::Message::Queue::DQS; # create a message queue $mq = Messaging::Message::Queue::DQS->new(path => "/some/where"); # add a message to the queue $msg = Messaging::Message->new(body => "hello world"); printf("msg added as %s\n", $mq->add_message($msg)); # browse the queue for ($name = $mq->first(); $name; $name = $mq->next()) { next unless $mq->lock($name); $msg = $mq->get_message($name); # one could use $mq->unlock($name) to only browse the queue... $mq->remove($name); }
This module provides an abstraction of a message queue. It derives from the Directory::Queue::Simple module that provides a generic directory based queue.
It simply stores the serialized message (with optional compression) as a Directory::Queue::Simple element.
In addition to the methods inherited from Directory::Queue::Simple, the following methods are available:
return a new Messaging::Message::Queue::DQS object (class method), the OPTIONS are the ones for Directory::Queue::Simple->new() with the addition of compression, like for Messaging::Message->jsonify()
compression
add the given message (a Messaging::Message object) to the queue and return the corresponding element name
get the message from the given element (which must be locked) and return a Messaging::Message object
Directory::Queue::Simple, Messaging::Message, Messaging::Message::Queue.
Lionel Cons http://cern.ch/lionel.cons
Copyright (C) CERN 2011-2013
To install Messaging::Message, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Messaging::Message
CPAN shell
perl -MCPAN -e shell install Messaging::Message
For more information on module installation, please visit the detailed CPAN module installation guide.