Dispatcher

Describes the role of the Dispatcher component, detailing how it communicates with other Enterprise Server for .NET components, and providing hosting details.

The Dispatcher is the service responsible for queuing client requests received from a listener, and dispatching requests to available SEPs.

At the start of a client session, the Dispatcher registers the session with the region database.

Queued requests and task execution

Client requests received from a Listener are queued by means of a stored procedure in the region database. The stored procedure prioritizes the requests and determines whether there is a SEP available to dispatch the waiting request with the highest priority. If a SEP is available, the stored procedure returns the ID of the request to be dispatched to the Dispatcher. The Dispatcher then invokes a SEP service, assigning it the returned request ID, and the requested task is run in that SEP.

Note: If the maximum number of SEPs configured for the region are currently running tasks, the stored procedure indicates this to the Dispatcher and no SEP service is invoked.

The output from a task is sent directly from the SEP to the Listener. If a response from an SEP is sent as a task is executing, the next client input for the same session is routed by the Listener directly to the SEP running the task. If the response from the SEP is sent at the end of task execution, the next client input for the same session is routed to the Dispatcher by the Listener as a new request.

When a task completes, the SEP that was running it invokes a stored procedure that removes the request from the queue, and gets the next highest-priority available request to execute. In other words, it is not the Dispatcher that waits until a SEP becomes available to dispatch the next request, it is a running SEP that determines and executes the next available request.

Scheduled task execution

The Dispatcher can also be invoked by the event monitor to dispatch a scheduled task. You create a scheduled task using the START API to start a new task either immediately, or by setting a timer to start the task when the timer expires. When a timer expires, the cross-region database posts an event that is picked up by an event monitor process. The event monitor then invokes a Dispatcher service, passing it information about the scheduled task. The Dispatcher builds and queues a request for the task in much the same way as it queues a request from a Listener process.

Hosting

The Dispatcher is hosted as follows:

Default: WAS-hosted
Started by Event Monitor, SEP, or User Interface
Process w3wp.exe
Alternative: Self-hosted
Process seedisp.exe