Author: indika Date: Wed Jun 24 23:19:10 2009 New Revision: 39860 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=39860
Log: sync with branch Modified: trunk/esb/java/docs/xdoc/extensions_guide.xml Modified: trunk/esb/java/docs/xdoc/extensions_guide.xml URL: http://wso2.org/svn/browse/wso2/trunk/esb/java/docs/xdoc/extensions_guide.xml?rev=39860&r1=39859&r2=39860&view=diff ============================================================================== --- trunk/esb/java/docs/xdoc/extensions_guide.xml (original) +++ trunk/esb/java/docs/xdoc/extensions_guide.xml Wed Jun 24 23:19:10 2009 @@ -480,5 +480,81 @@ org.apache.synapse.config.xml.MediatorFactory org.apache.synapse.config.xml.MediatorSerializer /... the implementation classes as usual...</pre> - </body> -</html> \ No newline at end of file + + +<h2>Scheduled Tasks</h2> + +<p></p> + +<p>Task is a one of method to automatically driving the mediation in the ESB. +This is an implementation of ESB Startup which allowed adding tasks should run +at ESB startup. Task is a Startup and it is based on Quartz, an open source job +scheduling system. Task can be used to create simple or complex schedules. A +simple schedule may be a schedule to run a task periodically. A complex +schedule may be a schedule to run at specific time in future. A complex +schedule can be specified using cron expressions.</p> + +<p></p> +<pre><task class="string" name="string" [group="string"] [pinnedServers="(serverName)+"]> + <property name="string" value="String"/> + <property name="string"><somexml>config</somexml></property> + <trigger ([[count="int"]? interval="int"] | [cron="string"] | [once=(true | false)])/> +</task></pre> + +<p></p> + +<p>A task is created and scheduled to run at specified time intervals or as +specified by the cron expression. The Task class specifies the actual task +implementation class</p> + +<p> (which must implement +<strong>org.apache.synapse.task.Task</strong><strong>interface</strong>) to be +executed at the specified interval/s, and name specifies an identifier for the +scheduled task.</p> + +<p> In the current ESB , there is only one implementation - +<strong>org.apache.synapse.startup.tasks.MessageInjector</strong>.This can be +used to inject messages at ESB startup.</p> + +<p></p> + +<p>Fields in the task class can be set using properties provided as string +literals or as XML fragments. (For example; if the task implementation class +has a field named "version" with a corresponding setter method, the +configuration value which will be assigned to this field before running the +task can be specified using a property with the name 'version')</p> + +<p></p> + +<p>There are three different trigger mechanisms to schedule tasks. A simple +trigger is specified specifying a 'count' and an 'interval', implying that the +task will run a 'count' number of times at specified intervals. A trigger may +also be specified as a cron trigger using a cron expression. A one-time trigger +is specified using the 'once' attribute as true in the definition and could be +specified as true in which case this task will be executed only once just after +the initialization of ESB. You can give a list of Synapse server names where +this task should be started using pinnedServers attribute. Refer to the +explanation of this attribute under proxy services for more information.</p> + +<p></p> + +<h3>Extending Task</h3> + +<p>A custom Task can be developed by writing a custom Java class that +implements the <strong>org.apache.synapse.task.Task interface</strong>. Task +interface is shown bellow.</p> + +<p></p> +<pre>package org.apache.synapse.task; + +/*** Represents an executable Task*/ + +public interface Task { + + /*** Execute method will be invoked by the QuartzJOb. + */ + public void execute(); + +}</pre> +</body> +</html> _______________________________________________ Esb-java-dev mailing list [email protected] https://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev
