NAME

Mvalve - Generic Q4M Powered Message Pipe

SYNOPSIS

my $mvalve = Mvalve->new(
  state => {
    module => "...",
  },
  queue => {
    module => "...",
    connect_info => [ ... ]
  },
  throttler => {
    module => 'Data::Throttler::Memcached',
    max_items => $max,
    interval  => $interval,
    cache     => {
      data => [ ... ]
    }
  }
);

while ( 1 ) {
  my $message = $mvalve->next;
  if ($message) {
    # do whatever
  }
}

DESCRIPTION

Mvalve stands for "Messave Valve". It is a frontend for Q4M powered set of queues, acting as a single pipe.

METHODS

next

Fetches the next available message.

insert

Inserts into the normal queue

defer

Inserts in the the retry_wait queue.

is_pending( $destination )

Checks whethere there are pending retries for that particular destination.

throttler

throttler holds the Data::Throttler instance that does the dirty work of determining if a message needs to be throttled or not

$self->throttler( {
  module => "Data::Throttler::Memcached",
} );

timeout

timeout specifies the timeout value while we wait to read from the queue.

queue

queue is the actual queue instance that we'll be dealing with. While the architecture is such that you can replace the queue with your custom object, we currently only support Q4M

 $self->queue( {
   module => "Q4M",
   connect_info => [ 'dbi:mysql:...', ..., ... ]
} );

clear_all

Clears all known queues that are listed under the registered QueueSet

trace

This is for debugging only

CONSTANTS

DESTINATION_HEADER

EMERGENCY_HEADER

MVALVE_TRACE

RETRY_HEADER

AUTHORS

Daisuke Maki <daisuke@endeworks.jp>

Taro Funaki <t@33rpm.jp>

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html