Spread::Queue - One-of-many queued messaging delivery, using Spread
$ sqm myqueue
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); }
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" });
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.
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.
SPREAD_QUEUE_NAME - default queue name if not provided in constructor (used by sqm, worker and sender)
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)
Jason W. May <jmay@pobox.com>
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
L<Spread::Session> L<Spread> http://www.tibco.com/products/rv/index.html L<Data::Serializer>
To install Spread::Queue::FIFO, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Spread::Queue::FIFO
CPAN shell
perl -MCPAN -e shell install Spread::Queue::FIFO
For more information on module installation, please visit the detailed CPAN module installation guide.