Class WorkDispatcher
Represents a default dispatcher that dispatches WorkContext calls on the same thread that calls Dispatch(work).
May extend this class to implement custom dispatchers, i.e. the once that maintain their won work queue/worker threads
Inheritance
System.Object
WorkDispatcher
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Azos.Wave.dll
Syntax
public class WorkDispatcher : Daemon<WaveServer>, IDisposable, IDaemon, IDaemonView, IApplicationComponent, INamed, IConfigurable, ILocalizedTimeProvider
Constructors
WorkDispatcher(WaveServer)
Declaration
public WorkDispatcher(WaveServer director)
Parameters
Properties
ComponentLogTopic
Declaration
public override string ComponentLogTopic { get; }
Property Value
Type |
Description |
System.String |
|
Overrides
Filters
Returns ordered registry of filters
Declaration
public IRegistry<WorkFilter> Filters { get; }
Property Value
Handlers
Returns ordered registry of handlers
Declaration
public IRegistry<WorkHandler> Handlers { get; }
Property Value
Methods
Destructor()
Declaration
protected override void Destructor()
Overrides
Dispatch(WorkContext)
Dispatches work into appropriate handler passing through filters.
The default implementation processes requests on the calling thread and disposes WorkContext deterministically
Declaration
public virtual void Dispatch(WorkContext work)
Parameters
Declaration
protected override void DoConfigure(IConfigSectionNode node)
Parameters
Overrides
GetWorkHandler(WorkContext)
Finds the most appropriate work handler to do the work.
The default implementation finds first handler with matching URI pattern or null
Declaration
public virtual WorkHandler GetWorkHandler(WorkContext work)
Parameters
Returns
HandleException(WorkContext, WorkFilter, WorkHandler, Exception)
Handles processing exception - this implementation uses server-wide behavior.
All parameters except ERROR can be null - which indicates error that happened during WorkContext dispose
Declaration
public virtual void HandleException(WorkContext work, WorkFilter filter, WorkHandler handler, Exception error)
Parameters
InvokeHandler(WorkContext, out WorkHandler)
Finds appropriate handler and invokes it. Returns the appropriate handler or null if work was aborted or already handled.
Throws if appropriate handler was not found
Declaration
public virtual void InvokeHandler(WorkContext work, out WorkHandler handler)
Parameters
RegisterFilter(WorkFilter)
Registers filter and returns true if the named instance has not been registered yet
Note: it is possible to call this method on active server that is - inject filters while serving requests
Declaration
public bool RegisterFilter(WorkFilter filter)
Parameters
Returns
Type |
Description |
System.Boolean |
|
RegisterHandler(WorkHandler)
Registers handler and returns true if the named instance has not been registered yet
Note: it is possible to call this method on active server that is - inject handlers while serving requests
Declaration
public bool RegisterHandler(WorkHandler handler)
Parameters
Returns
Type |
Description |
System.Boolean |
|
UnRegisterFilter(WorkFilter)
Unregisters filter and returns true if the named instance has been removed
Note: it is possible to call this method on active server that is - remove filters while serving requests
Declaration
public bool UnRegisterFilter(WorkFilter filter)
Parameters
Returns
Type |
Description |
System.Boolean |
|
UnRegisterHandler(WorkHandler)
Unregisters handler and returns true if the named instance has been removed
Note: it is possible to call this method on active server that is - remove handlers while serving requests
Declaration
public bool UnRegisterHandler(WorkHandler handler)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Implements
System.IDisposable
Extension Methods