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 to Tibco::Rv::WAIT_FOREVER.

Upon creating $dispatcher, it starts a separate thread, which repeatedly calls timedDispatch 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 is Tibco::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 is Tibco::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 call timedDispatch 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 is undef, sets name to ''.

$dispatcher->DESTROY

Exits the thread and destroys $dispatcher. Called automatically at program exit.

SEE ALSO

Tibco::Rv::Queue
Tibco::Rv::QueueGroup

AUTHOR

Paul Sturm <sturm@branewave.com>