1Messaging::Message::QueUusee:r:DCQoSn(t3r)ibuted Perl DoMceusmseangtiantgi:o:nMessage::Queue::DQS(3)
2
3
4
6 Messaging::Message::Queue::DQS - abstraction of a
7 Directory::Queue::Simple message queue
8
10 use Messaging::Message;
11 use Messaging::Message::Queue::DQS;
12
13 # create a message queue
14 $mq = Messaging::Message::Queue::DQS->new(path => "/some/where");
15
16 # add a message to the queue
17 $msg = Messaging::Message->new(body => "hello world");
18 printf("msg added as %s\n", $mq->add_message($msg));
19
20 # browse the queue
21 for ($name = $mq->first(); $name; $name = $mq->next()) {
22 next unless $mq->lock($name);
23 $msg = $mq->get_message($name);
24 # one could use $mq->unlock($name) to only browse the queue...
25 $mq->remove($name);
26 }
27
29 This module provides an abstraction of a message queue. It derives from
30 the Directory::Queue::Simple module that provides a generic directory
31 based queue.
32
33 It simply stores the serialized message (with optional compression) as
34 a Directory::Queue::Simple element.
35
37 In addition to the methods inherited from Directory::Queue::Simple, the
38 following methods are available:
39
40 new(OPTIONS)
41 return a new Messaging::Message::Queue::DQS object (class method),
42 the OPTIONS are the ones for Directory::Queue::Simple->new() with
43 the addition of "compression", like for
44 Messaging::Message->jsonify()
45
46 add_message(MESSAGE)
47 add the given message (a Messaging::Message object) to the queue
48 and return the corresponding element name
49
50 get_message(ELEMENT)
51 get the message from the given element (which must be locked) and
52 return a Messaging::Message object
53
55 Directory::Queue::Simple, Messaging::Message,
56 Messaging::Message::Queue.
57
59 Lionel Cons <http://cern.ch/lionel.cons>
60
61 Copyright (C) CERN 2011-2021
62
63
64
65perl v5.36.0 2022-07-22 Messaging::Message::Queue::DQS(3)