The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mvalve - Generic Q4M Powered Message Pipe

SYNOPSIS

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

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

METHODS

next

Fetches the next available message.

insert

Inserts into the normal queue

next_retry

Fetches the next message waiting to be requeued in retry_wait queue to the retry queue.

insert_retry

Inserts into the retry queue, noting the next fetch time.

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>