NAME
Tibco::Rv::Dispatcher - Tibco Queue dispatching thread
SYNOPSIS
$queue = $rv->createQueue;
$dispatcher = new Tibco::Rv::Dispatcher( dispatchable => $queue );
DESCRIPTION
A Tibco::Rv::Dispatcher
object is an independent thread that repeatedly dispatches events waiting on the specified dispatchable. A dispatchable is either a Tibco::Rv::Queue or a Tibco::Rv::QueueGroup.
CONSTRUCTOR
- $dispatcher = new Tibco::Rv::Dispatcher( %args )
-
%args: dispatchable => $dispatchable, name => $name, idleTimeout => $idleTimeout
Creates a
Tibco::Rv::Dispatcher
. If not specified, dispatchable defaults to the Default Queue, name defaults to 'dispatcher', and idleTimeout defaults toTibco::Rv::WAIT_FOREVER
.Upon creating
$dispatcher
, it starts a separate thread, which repeatedly callstimedDispatch
on$dispatchable
, passing it the$idleTimeout
value. The thread exits after$idleTimeout
seconds have passed without any events being placed on the$dispatchable
.$idleTimeout
can specify fractional seconds.If
$idleTimeout
isTibco::Rv::WAIT_FOREVER
(the default value), then$dispatcher
continues dispatching events until DESTROY is called or the program exits -- when no events are waiting on the$dispatchable
in this case,$dispatcher
simply blocks. If$idleTimeout
isTibco::Rv::NO_WAIT
, then$dispatcher
dispatches events until no events are waiting on$dispatchable
, at which point the thread exits.
METHODS
- $dispatchable = $dispatcher->dispatchable
-
Returns the Queue or QueueGroup that
$dispatcher
is dispatching events on. - $idleTimeout = $dispatcher->dispatchable
-
Returns the idleTimeout value
$dispatcher
is using to calltimedDispatch
on its dispatchable. - $name = $dispatcher->name
-
Returns the name of
$dispatcher
. - $dispatcher->name( $name )
-
Sets
$dispatcher
's name to$name
. Use this to distinguish multiple dispatchers and assist troubleshooting. If$name
isundef
, sets name to ''. - $dispatcher->DESTROY
-
Exits the thread and destroys
$dispatcher
. Called automatically at program exit.
SEE ALSO
AUTHOR
Paul Sturm <sturm@branewave.com>