Naveed Massjouni > POE-Component-MessageQueue > POE::Component::MessageQueue::Storage::Default

Download:
POE-Component-MessageQueue-0.3001.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

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 => 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::BigMemory as the front store and POE::Component::MessageQueue::Storage::FileSystem as the back store 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 ^

timeout => SCALAR

The number of seconds after a message enters the front-store before it expires. After this time, if the message hasn't been removed, it will be moved into the backstore.

granularity => SCALAR

The number of seconds to wait between checks for timeout expiration.

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_max => SCALAR

The maximum number of bytes to allow the front store to grow to. If the front store grows to big, old messages will be "pushed off" to make room for new messages.

front => SCALAR

An optional reference to a storage engine to use as the front store instead of POE::Component::MessageQueue::Storage::BigMemory.

SUPPORTED STOMP HEADERS ^

Same as POE::Component::MessageQueue::Storage::Complex.

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

syntax highlighting: