Messagi...ue::DQN(3)
NAME π
okay so bestie, this is Messaging::Message::Queue::DQN β filed under Messagi...ue::DQN(3) in the User Contributed Perl Documentation, and itβs literally the abstraction of a Directory::Queue::Normal message queue. yes, thatβs the whole NAME vibe π
β¨
SYNOPSIS π¦
hereβs the entire group-chat demo, no cap:
use Messaging::Message;
use Messaging::Message::Queue::DQN;
# create a message queue
$mq = Messaging::Message::Queue::DQN->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);
}
DESCRIPTION π
so like, this module provides an abstraction of a message queue. It derives from the Directory::Queue::Normal module, which provides a generic directory based queue. iconic inheritance moment fr fr.
It uses the following Directory::Queue::Normal schema to store a message:
$schema = {
header => "table",
binary => "binary?",
text => "string?",
};
so the message header is therefore stored as a table, and the message body is stored either as a text or binary string β slay π
METHODS π
In addition to the methods inherited from Directory::Queue::Normal, the following methods are available, bestie:
new(OPTIONS) β¨
return a new Messaging::Message::Queue::DQN object (class method), and the OPTIONS are the ones for Directory::Queue::Normal->new(). periodt.
add_message(MESSAGE) π«Ά
add the given message (a Messaging::Message object) to the queue and return the corresponding element name. cute, useful, ate.
get_message(ELEMENT) π«
get the message from the given element (which must be locked β do not skip the lock, bestie π) and return a Messaging::Message object.
SEE ALSO π
go peek at these too:
Directory::Queue::NormalMessaging::MessageMessaging::Message::Queue
AUTHOR π
Lionel Cons <http://cern.ch/lionel.cons>
Copyright (C) CERN 2011-2016
xoxo, this little page is brought to you by perl v5.32.1, dated 2019-07-26 π«Άπ
π¦ where this page comes from
- epel 9: perl-Messaging-Message 1.6.1-10.el9 Β· GPL+ or Artistic
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms