XecMe does 2 distinct functions viz.
public class MyQueueReader: ITask
{
....
public void OnStart(ExecutionContext context)
{
//Setting up a Queue for processing order
.....
}
public ExecutionState OnExecute(ExecutionContext context)
{
//Read the Queue
//Update the ExecutionContext
}
public void OnStop(ExecutionContext context)
{
//Clean up the Queue connection
.....
}
}
public class MyOrderProcessing: ITask
{
....
public void OnStart(ExecutionContext context)
{
//Initialize the task
.....
}
public ExecutionState OnExecute(ExecutionContext context)
{
//Read the ExecutionContext for data
// Process the order and update
}
public void OnStop(ExecutionContext context)
{
//Clean up
.....
}
}
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="xecMe.Core" type="XecMe.Configuration.XecMeSectionGroup, XecMe.Configuration, Version=1.2.0.0, Culture=neutral, PublicKeyToken=e34de6d98c38471a">
<section name="extensions" type="XecMe.Configuration.ExtensionsSection, XecMe.Configuration, Version=1.2.0.0, Culture=neutral, PublicKeyToken=e34de6d98c38471a"/>
<section name="taskManager" type="XecMe.Core.Configuration.TaskManagerSection, XecMe.Core, Version=1.2.0.0, Culture=neutral, PublicKeyToken=e34de6d98c38471a"/>
</sectionGroup>
</configSections>
<xecMe.Core>
<extensions>
<taskRunners>
<!-- Whatever is defined in the name below the same tags are to be used in taskRunners section under taskManager -->
<!-- The type is the type of the element for the defined tag -->
<!-- One can implement other type of TaskRunner by inheriting from TaskRunner class-->
<!-- TaskRunnerElement inheriting from TaskRunnerElement class-->
<add name="parallelTaskRunner" type="XecMe.Core.Configuration.ParallelTaskRunnerElement, XecMe.Core, Version=1.2.0.0, Culture=neutral, PublicKeyToken=e34de6d98c38471a"/>
<add name="timerTaskRunner" type="XecMe.Core.Configuration.TimerTaskRunnerElement, XecMe.Core, Version=1.2.0.0, Culture=neutral, PublicKeyToken=e34de6d98c38471a"/>
<add name="eventTaskRunner" type="XecMe.Core.Configuration.EventTaskRunnerElement, XecMe.Core, Version=1.2.0.0, Culture=neutral, PublicKeyToken=e34de6d98c38471a"/>
<add name="scheduledTaskRunner" type="XecMe.Core.Configuration.ScheduledTaskRunnerElement, XecMe.Core, Version=1.2.0.0, Culture=neutral, PublicKeyToken=e34de6d98c38471a"/>
</taskRunners>
<settings>
<!-- IBatchProcess is needed if you are configuring a batch process-->
<add name="IBatchProcess" type="Sample.MyBatch, Sample, Version=1.0.0.0, PublicKeyToken=null, Culture=neutral"/>
<!-- IService is needed if you are configuring a batch process-->
<add name="IService" type="Sample.MyService, Sample, Version=1.0.0.0, PublicKeyToken=null, Culture=neutral"/>
</settings>
</extensions>
<taskManager>
<taskRunners>
<eventTaskRunner name="Order Process" taskType="Fully Qualified Task Name of ITask" eventTopic="Name of the event" threadOption="BackgroundParallel">
<!-- Parameters serve as input parameters to the task-->
<parameters>
<parameter name="test1" value="val1"/>
<parameter name="test2" value="val2"/>
<parameter name="test3" value="val3"/>
</parameters>
</eventTaskRunner>
<!-- The taskType attribute should be an impletementation of ITask-->
<timerTaskRunner name="Queue monitor"
taskType="Fully Qualified Type Name of ITask implementation should go here"
interval="time between the triggers"
startDateTime="Start date time for this task"
endDateTime="End date time for this task"
dayStartTime="Start time of the day"
dayEndTime="End time of the day"
recurrence="number of time"
timeZone="time zone id string - task will be triggered for this time zone">
<!-- Parameters serve as input parameters to the task-->
<parameters>
<parameter name="test1" value="val1"/>
<parameter name="test2" value="val2"/>
<parameter name="test3" value="val3"/>
</parameters>
</timerTaskRunner>
<parallelTaskRunner name="Parallel Task" taskType="Fully qualified type" minInstances="2" maxInstances="10">
<parameters>
<parameter name="test1" value="val1"/>
<parameter name="test2" value="val2"/>
<parameter name="test3" value="val3"/>
</parameters>
</parallelTaskRunner>
<scheduledTaskRunner name="Scheduled Task"
taskType="Fully qualified task type"
repeat="Skip every x days/weeks/months"
recursion="Daily|Weekly|Monthly"
startDate="Date for initial reference"
taskTime="Time at which task is triggered"
schedule="schedule string for Weekly / Monthly recursion"
timeZone="time zone id string - task will be triggered for this time zone">
<parameters>
<parameter name="test1" value="val1"/>
<parameter name="test2" value="val2"/>
<parameter name="test3" value="val3"/>
</parameters>
</scheduledTaskRunner>
</taskRunners>
</taskManager>
</xecMe.Core>
</configuration>
TaskManager will load all the task using reflection and run them based on the configurations. This way you can configure diverse functional tasks in a single process without bothering the context switching, threading model etc.
for question you may have. Feel free to drop a note or comment in case you have issues or difficulties configuring the tasks. I have been using this for all my server side processing needs