NAME

POE::Component::MessageQueue::Storage::Complex -- A storage engine that keeps messages in memory but moves them into persistent storage after a given number of seconds.

SYNOPSIS

use POE;
use POE::Component::MessageQueue;
use POE::Component::MessageQueue::Storage::Complex;
use strict;

my $DATA_DIR = '/tmp/perl_mq';

POE::Component::MessageQueue->new({
  storage => POE::Component::MessageQueue::Storage::Complex->new({
    data_dir     => $DATA_DIR,
    timeout      => 4,
    throttle_max => 2
  })
});

POE::Kernel->run();
exit;

DESCRIPTION

This storage engine combines all the other provided engine. It uses POE::Component::MessageQueue::Storage::Memory as the "front-end storage" and POE::Component::MessageQueue::Storage::FileSystem as the "back-end storage". Message are initially put into the front-end storage and will be moved into the backend storage after a given number of seconds.

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 body's.

timeout => SCALAR

The number of seconds a message will remain in non-persistent storage. Ie. After this many seconds if the message hasn't been removed, it will be put to persistent storage.

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.

SEE ALSO

DBI, DBD::SQLite, POE::Component::MessageQueue, POE::Component::MessageQueue::Storage, POE::Component::MessageQueue::Storage::Memory, 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