NAME
POE::Component::MessageQueue::Storage::Default -- The default storage engine (based on Complex), recommended for the most common case and used by mq.pl.
SYNOPSIS
use POE;
use POE::Component::MessageQueue;
use POE::Component::MessageQueue::Storage::Default;
use strict;
my $DATA_DIR = '/tmp/perl_mq';
POE::Component::MessageQueue->new({
storage => POE::Component::MessageQueue::Storage::Default->new({
data_dir => $DATA_DIR,
timeout => 4,
throttle_max => 2,
# Alternative memory store available!
#front_store => POE::Component::MessageQueue::Storage::BigMemory->new(),
})
});
POE::Kernel->run();
exit;
DESCRIPTION
This storage engine combines all the other provided engines. It uses POE::Component::MessageQueue::Storage::Memory as the "front-end storage" and POE::Component::MessageQueue::Storage::FileSystem as the "back-end storage" for POE::Componenet::MessageQueue::Storage::Complex and provides some other sensible and recommended defaults, though you can override them in most cases. Message are initially put into the front-end storage and will be moved into the backend storage after a given number of seconds (defaults to 4).
The POE::Component::MessageQueue::Storage::FileSystem component used internally uses POE::Component::MessageQueue::Storage::DBI with a DBD::SQLite database. It is also throttled via POE::Component::MessageQueue::Storage::Throttled.
This is the recommended storage engine. It should provide the best performance while (if configured sanely) still providing a reasonable amount of persistence with little risk of eating all your memory under high load. This is also the only storage backend to correctly honor the persistent flag and will only persist those messages with it set.
CONSTRUCTOR PARAMETERS
- data_dir => SCALAR
-
The directory to store the SQLite database file and the message bodies.
- throttle_max => SCALAR
-
The max number of messages that can be sent to the DBI store at once. This value is passed directly to the underlying POE::Component::MessageQueue::Storage::Throttled.
- front_store => SCALAR
-
An optional reference to a storage engine to use as the front store instead of Storage::Memory. If you anticipate a high number of messages making their way into the front store (five thousand or more), or are experiences high loads and longer-than-anticpated waits for messages to make it out of the front store, consider overriding the front store to POE::Component::MessageQueue::Storage::BigMemory, which uses a different data structure that is optimized for large message loads.
SEE ALSO
POE::Component::MessageQueue, POE::Component::MessageQueue::Storage, DBI, DBD::SQLite
Other storage engines:
POE::Component::MessageQueue::Storage::Memory, POE::Component::MessageQueue::Storage::BigMemory, POE::Component::MessageQueue::Storage::FileSystem, POE::Component::MessageQueue::Storage::DBI, POE::Component::MessageQueue::Storage::Generic, POE::Component::MessageQueue::Storage::Generic::DBI, POE::Component::MessageQueue::Storage::Throttled, POE::Component::MessageQueue::Storage::Complex