-
-
05 Jun 2017 14:11:33 UTC
- Distribution: POE-Component-MessageQueue
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues
- Testers (428 / 46 / 0)
- Kwalitee
Bus factor: 1- 66.78% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (75.43KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 3 contributors- David Snopek (http://www.hackyourlife.org)
-
Paul Driver
-
Daisuke Maki
- Dependencies
- Best
- Carp
- DBD::SQLite
- DBI
- Data::Dumper
- Data::UUID
- Event::Notify
- Exception::Class::DBI
- Exception::Class::TryCatch
- File::Temp
- Heap
- Heap::Fibonacci
- IO::File
- IO::String
- Moose
- MooseX::MultiInitArg
- Net::EmptyPort
- Net::Stomp
- POE
- POE::Component::Generic
- POE::Component::Logger
- POE::Component::Server::TCP
- POE::Filter::Stomp
- POE::Wheel::ReadWrite
- Test::Exception
- Test::MockObject
- Test::More
- YAML
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
POE::Component::MessageQueue::Storage::Complex -- A configurable storage engine that keeps a front-store (something fast) and a back-store (something persistent), only storing messages in the back-store after a configurable timeout period.
SYNOPSIS
use POE; use POE::Component::MessageQueue; use POE::Component::MessageQueue::Storage::Complex; use strict; POE::Component::MessageQueue->new({ storage => POE::Component::MessageQueue::Storage::Complex->new({ timeout => 4, granularity => 2, # Only allow the front store to grow to 64Mb front_max => 64 * 1024 * 1024, front => POE::Component::MessageQueue::Storage::Memory->new(), # Or, an alternative memory store is available! #front => POE::Component::MessageQueue::Storage::BigMemory->new(), back => POE::Component::MessageQueue::Storage::Throttled->new({ storage => My::Persistent::But::Slow::Datastore->new() # Examples include: #storage => POE::Component::MessageQueue::Storage::DBI->new({ ... }); #storage => POE::Component::MessageQueue::Storage::FileSystem->new({ ... }); }) }) }); POE::Kernel->run(); exit;
DESCRIPTION
The idea of having a front store (something quick) and a back store (something persistent) is common and recommended, so this class exists as a helper to implementing that pattern.
The front store acts as a cache who's max size is specified by front_max. All messages that come in are added to the front store. Messages are only removed after having been successfully delivered or when pushed out of the cache by newer messages.
Persistent messages that are not removed after the number of seconds specified by timeout are added to the back store (but not removed from the front store). This optimization allows for the possibility that messages will be handled before having been persisted, reducing the load on the back store.
Non-persistent messages will be discarded when eventually pushed off the front store, unless the expire-after header is specified, in which case they may be stored on the back store inorder to keep around them long enough. Non-persistent messages on the back store which are passed their expiration date will be periodically cleaned up.
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.
- 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.
- back => SCALAR
-
Takes a reference to a storage engine to use as the back store.
Using POE::Component::MessageQueue::Storage::Throttled to wrap your main storage engine is highly recommended for the reasons explained in its specific documentation.
SUPPORTED STOMP HEADERS
SEE ALSO
POE::Component::MessageQueue::Storage::Complex::Default - The most common case. Based on this storage engine.
POE::Component::MessageQueue, POE::Component::MessageQueue::Storage, POE::Component::MessageQueue::Storage::Double
Other storage engines:
POE::Component::MessageQueue::Storage::Default, 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::Default
Module Install Instructions
To install POE::Component::MessageQueue, copy and paste the appropriate command in to your terminal.
cpanm POE::Component::MessageQueue
perl -MCPAN -e shell install POE::Component::MessageQueue
For more information on module installation, please visit the detailed CPAN module installation guide.