Spread::Queue::Manager - coordinate one-of-many message delivery


Spread-Queue documentation  | view source Contained in the Spread-Queue distribution.

Index


NAME

Top

Spread::Queue::Manager - coordinate one-of-many message delivery

SYNOPSIS

Top

The provided 'sqm' executable does this:

  use Spread::Queue::Manager;
  my $queue_name = shift @ARGV || die "usage: sqm queue-name";
  my $session = new Spread::Queue::Manager($queue_name);
  $session->run;

DESCRIPTION

Top

The queue manager is responsible for assigning incoming messages (see Spread::Queue::Sender) to registered workers (see Spread::Queue::Worker).

When a message comes in, it is assigned to the first available worker, otherwise it is put into a FIFO queue.

When a worker reports availability, it is sent the first pending message, otherwise it is put into a FIFO queue.

When a message is sent to a worker, the worker should immediately acknowledge receipt. If the worker does not acknowledge, the message will (eventually) be assigned to another worker.

If a queue manager is already running (detected via Spread group membership messages), the new sqm should terminate.

METHODS

Top

  my $session = new Spread::Queue::Manager($queue_name);

Initialize Spread messaging environment, and prepare to act as the queue manager. If queue_name is omitted, environment variable SPREAD_QUEUE will be checked.

  $session->run;

Run loop for the queue manager. Does not return unless interrupted.

AUTHOR

Top

Jason W. May <jmay@pobox.com>

COPYRIGHT

Top

SEE ALSO

Top

  L<Spread::Session>
  L<Spread::Queue::FIFO>
  L<Spread::Queue::Sender>
  L<Spread::Queue::Worker>
  L<Spread::Queue::ManagedWorker>
  L<Data::Serializer>


Spread-Queue documentation  | view source Contained in the Spread-Queue distribution.