The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Spread::Queue - One-of-many queued messaging delivery, using Spread

SYNOPSIS

Queue manager

  $ sqm myqueue

Worker ("server") process

  use Spread::Queue::Worker;

  my $worker = new Spread::Queue::Worker("myqueue");
  $worker->callbacks(
                     myfunc => \&myfunc,
                    );
  $SIG{INT} = \&signal_handler;
  $worker->run;

  sub myfunc {
    my ($worker, $originator, $input) = @_;

    my $result = {
                  response => "I heard you!",
                 };
    $worker->respond($originator, $result);
  }

Requesting ("client") process

  use Spread::Queue::Sender;

  my $sender = new Spread::Queue::Sender("myqueue");

  $sender->submit("myfunc", { name => "value" });
  my $response = $sender->receive;

or

  my $response = $sender->rpc("myfunc", { name => "value" });

WARNING

THIS IS ALPHA SOFTWARE. There are no guarantees that the current interchange will remain, or that it will work in even remotely the same way.

DESCRIPTION

Message-queueing layer using Spread for message delivery.

Queues are managed by a dedicated manager process (sqm). This agent coordinates task assignments for some number of workers who accept messages delivered to a queue (a Spread public group).

Workers register their availability with the queue manager, and are assigned tasks when available. The worker knows the originator of each message, so responses (if needed) can be sent directly to the originator's private mailbox.

ENVIRONMENT

  SPREAD_QUEUE_NAME - default queue name if not provided in constructor
                        (used by sqm, worker and sender)

TO DO

Worker auto-launch sqm.

Should co-exist with non-queueing Spread messaging (should be able to share a Spread::Session)

Co-exist with event frameworks: POE, Stem, others

Manager should have a private queue available for status reporting and possible control functions.

sqm should maintain activity metrics and provide admin reports; workers should possibly maintain some stats as well. Interesting metrics include total # of tasks assigned, current # of workers, total # of different workers that have ever registered since this manager started, utilization of those workers, start time of manager, start times of active workers, process info for manager and workers (host, pid, memory usage, priority, etc.), idle time of active workers.

Let app choose Data::Serialization option (e.g. YAML)

AUTHOR

Jason W. May <jmay@pobox.com>

COPYRIGHT

Copyright (C) 2002 Jason W. May. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The license for the Spread software can be found at http://www.spread.org/license

SEE ALSO

  L<Spread::Session>
  L<Spread>
  http://www.tibco.com/products/rv/index.html
  L<Data::Serializer>