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

POE::Component::GCS::Server::Queue - Generic queue service

VERSION

This document describes version 0.04, released March, 2006.

SYNOPSIS

use POE::Component::GCS::Server::Queue;
spawn POE::Component::GCS::Server::Queue;

$poe_kernel->post( "queue", $message, $priority );

DESCRIPTION

This class provides a generic process queuing service. This allows "controlled process parallelism" within the Generic Server.

Constructor

spawn ( [ MaxConcurrent ] )

This creates a new generic queue manager object. Note that the object created is implemented as a 'singleton', meaning that any subsequent calls to this method will return the original object created by the first call to this method.

The optional MaxConcurrent parameter can be added to specify the maximum number of concurrent child processes that are allowed to run at any given time. This value defaults to 3.

Methods

There are no public methods other than those described above.

Events

( queue, Message, Priority )

This POE event allows queing tasks to run with the certainty that only a limited number of tasks will run concurrently.

$poe_kernel->post( queue => $message, $messagePriority );
queue

This is the name of the event to queue the given task.

Message

The required Message argument is expected to be an object or subclass of the 'POE::Event::Message' class.

As input, the message is expected to contain a command recognized by the 'POE::Component::GCS::Server::Proc' class, or a subclass thereof.

For output, the results from running the command are included as the body of the reply. The message is expected to contain one or more predefined routing header(s).

DEPENDENCIES

This class is expected to be run with the POE framework.

SEE ALSO

For discussion of the generic server, see POE::Component::GCS::Server. For discussion of the message protocol, see POE::Event::Message.

For implementation of the message protocol in the GCS server, see POE::Component::GCS::Server::Msg.

AUTHOR

Chris Cobb, <no spam [at] ccobb [dot] net>

COPYRIGHT

Copyright (c) 2005-2010 by Chris Cobb. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.