Creating an XML task file

ActiveQ

Creating an XML tasks file

 

An XML tasks configuration file (if not already created) can be generated with any text editor. Use a plain text editor only (Notepad, Ultraedit, Textpad, etc...) and not a rich text editor (Word, Wordpad, Html TextBox, etc...) to edit the file (as these rich text editors may add special formatting codes which are invalid in XML).
 

Don't worry if you are not familiar with XML. A sample XML configuration file can be found at the bottom of this document.

A really cool ActiveQ XML configuration file editor will be available soon.

 

Structure of the XML tasks configuration file

 

Here is the structure of the XML tasks configuration file :

 

<?xml version="1.0" encoding="utf-8"?>

<config xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <tasks>

     ...

    </tasks>

</config>

 

Each task have the following structure :

 

<task method="POST">

    <id>1</id>

    <address>http://www.domain.com/ActiveQ/ActiveQTestWeb/WebForm1.aspx</address>

    <datestart>2003-05-22</datestart>

    <dateend>2003-06-30</dateend>

    <recurrences>

        <recurrence>

          <type>selectedDay</type>

          <parameter>Friday</parameter>    

          <hour>11:30:00</hour>

        </recurrence>

    </recurrences>

</task>

 

<task> element

 

The "attribute" method can only have one of two values: POST or GET.

 

GET

This sends the form information included in the URL. The GET method sends the information to the server in one step. It is best used for forms where the information is not secure (as it can be seen in the URL), and the amount of information passed is small.

    

POST

This sends the form information in the HTTP environment. It is a little more secure, in that your readers can't see it directly (although it is sent as clear text, so it can be "hijacked"). The post method sends the data to the server in two steps. First the browser contacts the server and, after the contact is made, it sends the information. It is best used when you have a lot of information to pass. Currently, you can't define custom fields and values to pass. However, this is planned for a future release of ActiveQ.

 

FILE

This attribute let you execute a file on the computer. The <address> attribute is the path to the file.

 

<id> element

 

Each task is identified by a unique id. Be careful to use a unique id. Otherwise, only the first task defined with that id will be used. Other tasks with the same id will be ignored.

 

<address> element

 

Address used for the request. Usually the URL to the script file or the UNC path to the file you want to execute  .

 

<datestart> element

 

Start date of the task. No tasks are executed before this date.

 

<dateend> element

 

End date of the task. No tasks are executed after this date.
 

For recurring tasks, you can combine several <recurrence> elements. Each recurrence must have a <type> and an <hour> child element. The <parameter> element is used for some types and will be  described later.

    

<type> element

 

Indicates the type of recurrence and can have the following values :
 

  • once: task executed only one time at the <hour> specified. The value of the <hour> element must have the following structure :

    HH:MM:SS

    Example : 23:21:59 specifies 23h 21min 59sec or 9:21:59 pm.
     

  • daily: the task executes each day at the <hour> specified.
     

  • selectedDay: the task executes each day specified by the <parameter> element at the <hour> specified. The <parameter> element must have one of the following values: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" and "Sunday".
     

  • selectedDate: the task executes on each date specified by <parameter> at the <hour> specified. The <parameter> element value indicates the date when the task must run. The date should be in the following format:

    YYYY-MM-DD


    Example: 2003-05-29 specifies May 29th, 2003.

    Be careful to use a valid day, for instance, if you specified 31 as day, the task will not execute on the 31st of each month because some months contains less than 31 days.

 

Once you have created (or modified) your XML tasks configuration file, you need to add it the ActiveQ scheduled tasks queue. If this hasn’t already been done by your administrator, you will need administrator access to the server to add your file to the queue. Read the document “Using the XML tasks file” for more information.

 

Sample Configuration File

 

Here is a sample XML tasks configuration file :

 

<?xml version="1.0" encoding="utf-8"?>

<config xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <tasks>

    <task method="post">

      <id>1</id>

      <address>http://www.domain.com/ActiveQ/ActiveQTestWeb/WebForm1.aspx</address>

      <datestart>2003-05-22</datestart>

      <dateend>2003-06-30</dateend>

      <recurrences>

        <recurrence>

          <type>daily</type>

          <hour>15:51:00</hour>

        </recurrence>

        <recurrence>

          <type>daily</type>

          <hour>15:52:00</hour>

        </recurrence>

        <recurrence>

          <type>selectedDay</type>

          <parameter>Friday</parameter>   

          <hour>11:30:00</hour>

        </recurrence>

      </recurrences>

    </task>

    <task method="get">

      <id>2</id>

      <address>http://www.google.com</address>

      <datestart>2003-05-22</datestart>

      <dateend>2003-06-12</dateend>

      <recurrences>

        <recurrence>

          <type>selectedDay</type>

          <parameter>Friday</parameter>    

          <hour>11:30:00</hour>

        </recurrence>

      </recurrences>

    </task>

    <task method="post">

      <id>3</id>

      <address>http://www.yahoo.com</address>

      <datestart>2003-05-22</datestart>

      <dateend>2004-05-30</dateend>

      <recurrences>

        <recurrence>

          <type>daily</type>

          <hour>12:02:00</hour>

        </recurrence>

        <recurrence>

          <type>selectedDay</type>

          <parameter>Friday</parameter>    

          <hour>11:30:00</hour>

        </recurrence>

      </recurrences>

    </task>

    <task method="post">

      <id>3</id>

      <address>c:\system\backup.bat</address>

      <datestart>2003-02-22</datestart>

      <dateend>2005-02-30</dateend>

      <recurrences>

        <recurrence>

          <type>daily</type>

          <hour>00:00:00</hour>

        </recurrence>

      </recurrences>

    </task>

  </tasks>

</config>

 

 

 

Copyright © 2003 Active Up SPRL - All Rights Reserved - http://www.activeup.com