C# Class Westwind.MessageQueueing.Scheduler

A generic scheduling service that runs on a background thread and fires events in a given check frequency
Inheritance: IDisposable
显示文件 Open project: RickStrahl/Westwind.QueueMessageManager

Public Methods

Method Description
AddItem ( SchedulerItem item ) : void
AddItem ( byte data, string type ) : void
AddItem ( object item ) : void

Adds an item to the queue.

AddItem ( string textData, string type ) : void
Dispose ( ) : void
GetNextItem ( ) : object

Returns the next queued item or null on failure.

PingServer ( ) : void

Optional routine that pings a Url on the server to keep the server alive. Use this to avoid IIS shutting down your AppPools

Start ( ) : void

Starts the background Thread processing

Start ( int checkFrequency ) : void

Starts the background thread processing

Stop ( ) : void

Causes the processing to stop. If the operation is still active it will stop after the current message processing completes

Protected Methods

Method Description
OnError ( Exception ex ) : void

This method is called if an error occurs during processing of the request. Override this method in your own implementation to provide for error logging or other handling of an error that occurred in processing. Ideally this shouldn't be necessary - your OnexecuteScheduledEvent code should handle any errors internally and provide for its own logging mechanism but this is here as an additional point of control.

OnExecuteScheduledEvent ( ) : void

Handles a scheduled operation. Checks to see if an event handler is set up and if so calls it. This method can also be overrriden in a subclass to implemnent custom functionality.

Private Methods

Method Description
Run ( ) : void

Runs the actual processing loop by checking the mail box

Method Details

AddItem() public method

public AddItem ( SchedulerItem item ) : void
item SchedulerItem
return void

AddItem() public method

public AddItem ( byte data, string type ) : void
data byte
type string
return void

AddItem() public method

Adds an item to the queue.
public AddItem ( object item ) : void
item object
return void

AddItem() public method

public AddItem ( string textData, string type ) : void
textData string
type string
return void

Dispose() public method

public Dispose ( ) : void
return void

GetNextItem() public method

Returns the next queued item or null on failure.
public GetNextItem ( ) : object
return object

OnError() protected method

This method is called if an error occurs during processing of the request. Override this method in your own implementation to provide for error logging or other handling of an error that occurred in processing. Ideally this shouldn't be necessary - your OnexecuteScheduledEvent code should handle any errors internally and provide for its own logging mechanism but this is here as an additional point of control.
protected OnError ( Exception ex ) : void
ex System.Exception Exception occurred during item execution
return void

OnExecuteScheduledEvent() protected method

Handles a scheduled operation. Checks to see if an event handler is set up and if so calls it. This method can also be overrriden in a subclass to implemnent custom functionality.
protected OnExecuteScheduledEvent ( ) : void
return void

PingServer() public method

Optional routine that pings a Url on the server to keep the server alive. Use this to avoid IIS shutting down your AppPools
public PingServer ( ) : void
return void

Start() public method

Starts the background Thread processing
public Start ( ) : void
return void

Start() public method

Starts the background thread processing
public Start ( int checkFrequency ) : void
checkFrequency int Frequency that checks are performed in seconds
return void

Stop() public method

Causes the processing to stop. If the operation is still active it will stop after the current message processing completes
public Stop ( ) : void
return void