ScheduledHandler Class |
Namespace: NetQuarry
The ScheduledHandler type exposes the following members.
Name | Description | |
---|---|---|
ScheduledHandler | Initializes a new instance of the ScheduledHandler class |
Name | Description | |
---|---|---|
Application |
Returns the application object
| |
IsServiceStopped |
Returns true if the service has stopped. Services should check the value of this
property to ensure smooth shutdown of the service.
| |
Properties |
Returns the object's configuration properties
| |
RunDays |
Returns the days that this task should run
| |
TaskID |
The ID of the task as used in xmt_scheduled_tasks and xot_task_history.
| |
TaskState |
The task state data, from xot_task_history.task_state. This state belongs to
the task itself and can be used by the task as it sees fit. The latest value of the
state is provided to the task, when run, via this property, and any updated value is
retrieved from this property and persisted back to xot_task_history.task_state
when the tasks completes.
For example, this state could be used to store the sequence number of the last item processed so that on the next iteration of the task processing could begin from the next sequence number. |
Name | Description | |
---|---|---|
Equals | (Inherited from Object.) | |
Exec |
Executes a command.
| |
Finalize | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
OnExec |
Abstract Exec handler. Derived classes must implement this method.
| |
ToString | (Inherited from Object.) |
Name | Description | |
---|---|---|
EqualValue |
Determines if the object value is equal to another object. If the two objects are null, then this returns true.
There is special handling for guid comparisons (since a guid could be a string formatted in up to 3 different ways).
If the special guid handling is not performed, then the object.Equals method is used.
(Defined by EAPUtil.) |
public class SendMail : ScheduledHandler { public SendMail() {} protected override void OnExec(int cmdID, params object[] args) { if (cmdID == 1) { DoSendMail(); } } private void DoSendMail() { while (true) { System.Threading.Thread.Sleep(1000); if (IsServiceStopped) { DevLog.LogMessage("SendMail.DoSendMail", "sendMailStopped", "Service has been stopped, exiting send mail.", LogMessageLevel.Info); break; } else { DevLog.LogMessage("SendMail.DoSendMail", "sendMailRun", "Sending mail...", LogMessageLevel.Info); //--- do work here } } } }