Saturday, December 18, 2010

Scheduled Task Adapter

After considering the options for a project where interfacing in a scheduled manner was required i came across the Scheduled task adapter. This thing is so easy to use, I must speak about it!

The following section describes the steps required to implement the scheduled task adapter.

Installation
Register the components

To install the Scheduled task adapter download the adapter from ‘Codeplex’ (http://biztalkscheduledtask.codeplex.com/). Run the setup and follow the steps during the setup.

Note: In the current version the setup does not register the necessary dll’s in the Global Assembly Cache. These steps have to be performed manually.

- Start the Visual Studio command prompt

- Navigate to ‘C:\Program Files\Biztalk ScheduledTask Adapter’

- Run ‘GACUTIL –i Biztalk.Adapter.ScheduledTaskProperties.dll’

- Run ‘GACUTIL –i Calendar.Schedules.dll’

- Run ‘GACUTIL –i ScheduledTaskAdapter.Admin.dll’

- Run ‘GACUTIL –i ScheduledTaskAdapter.dll’

- Run ‘GACUTIL –i ScheduledTaskAdapter.TaskComponents.dll’

Add the adapter

Start the administration console and create a new adapter under ‘Platform settings’.

clip_image002

Select the Schedule adapter and name it as desired, for example ScheduledTaskAdapter

clip_image004

Restart the host instance

clip_image006

Configuration

The Scheduled task adapter has the ability to fire a trigger based on a regular interval. This trigger can be defined as desired, the most common usage is to use a String trigger which will submit a predefined String (e.g. an Xml message) to the messagebox so that it can be picked up by an Orchestration.

The first step is to create a new Receive port that will contain a receive location using the ScheduledTaskAdapter.

Create a new One-Way receive port

clip_image008

Create a new Receive location and select the ScheduledTaskAdapter, ensure that you choose XMLReceive as the receive pipeline.

clip_image010

Click on Configure and define a name for the schedule

clip_image012

Define a schedule which executes the tasks periodically

clip_image014

Select a task component

clip_image016

This tab allows the usage of implemented Task items. These are the actions performed, you can implement any task as long as it conforms to the API of the ScheduledTaskAdapter. In this case we will use a task type that is included with the Adapter.

Click on ‘FindTask’, this will show the assembly browser

clip_image018

Click on ‘Browse’ and select the assembly ‘ScheduledTaskAdapter.TaskComponents.dll’ (located in the Program Files\Biztalk ScheduledTask Adapter directory).

clip_image020

Double click the XMLStringStreamProvider and click ok

clip_image022

Under taskproperties, configure the XmlString that will be published on the messagebox at the moment the task is executed

clip_image024

Note: this is a xml instance that you can used as the first receive shape in the orchestration that should be started.

 

Have fun with it!

No comments: