WorkerThread

This control has no features applicable to VisualConnect application development

Initial Setup Properties

Common (Voice and Data)

DisconnectControl

IExitOnJobComplete

IMaximumThreads

IMaxWaitTime

IMinimumThreads

IThreadIdleTime

IVComments

 

 

Voice Only

GlobalToneControl

HelpDigitControl

IClearDigits

InvalidErrorControl

ITerminateOnVoice

ITerminationDTMF

IWaitType

 

 

Runtime Properties

Common (Voice and Data)

ExitOnJobComplete

GotoControl

GotoNode

JobData

MaxWaitTime

TermReason

Voice Only

WaitType

Greetings

Common (Voice and Data)

IEntryGreeting

IMusicGreeting

 

Data Only

IHintGreeting

HintGreeting

 

Methods

Common (Voice and Data)

StopWait

TakeCall

Events

Common (Voice and Data)

Disconnect

EnterEvent

Exit

PhraseError

PlayRequest

VoiceError

Overview

All VBVoice events' code is executed in the primary thread; in order to keep the system responsive this code should be as fast as possible. Blocking for a certain time would affect all other channels because they are waiting for their events' code to be executed. WorkerThread is helping to get your lengthy code executed in a separate thread and avoid blocking the primary thread.

The WorkerThread Control offers the application a way to run certain lengthy code (like accessing database or waiting synchronously for a resource) in a separate thread (worker thread), leaving the primary thread free to execute Windows and other VBVoice events. While waiting for completion of the action from the worker thread, the channel is doing voice processing in a way similar to the Delay control, playing music or waiting silently.

This is especially usefully when an outside process could take an unpredictable amount of time (e.g. a complex database query, or slow response times). The caller will experience this like a standard Delay Control, and the call will exit from the control after the code executed in the worker thread completed.

The call stays in WorkerThread until at least one of the following conditions are met:

- The code being executed in the worker thread has finished ( exited the Run function of the job class);

- The MaxWaitTime set for the WorkerThread Control has been reached.

Each WorkerThread control in a system has its own thread pool, but the following technique guarantees optimum usage of threads. At system start, a minimum number of threads (IMinimumThreads) are initialized. Later, more threads could be created as needed up to a maximum set by IMaximumThreads. The pool may also shrink to its minimum limit when certain threads are idle for period longer than IThreadIdleTime.

The WorkerThread control can operate in three modes: