Working With Worklets Overview
Working With Worklets Overview
By PenchalaRaju.Yanamala
To run a worklet, include the worklet in a workflow. The workflow that contains
the worklet is called the parent workflow. When the Integration Service runs a
worklet, it expands the worklet to run tasks and evaluate links within the worklet.
It writes information about worklet execution in the workflow log.
Suspending Worklets
When you choose Suspend on Error for the parent workflow, the Integration
Service also suspends the worklet if a task in the worklet fails. When a task in the
worklet fails, the Integration Service stops executing the failed task and other
tasks in its path. If no other task is running in the worklet, the worklet status is
“Suspended.” If one or more tasks are still running in the worklet, the worklet
status is “Suspending.” The Integration Service suspends the parent workflow
when the status of the worklet is “Suspended” or “Suspending.”
Developing a Worklet
To develop a worklet, you must first create a worklet. After you create a worklet,
configure worklet properties and add tasks to the worklet. You can create
reusable worklets in the Worklet Designer. You can also create non-reusable
worklets in the Workflow Designer as you develop the workflow.
Create reusable worklets in the Worklet Designer. You can view a list of reusable
worklets in the Navigator Worklets node.
You can create a non-reusable worklet in the Workflow Designer as you develop
the workflow. Non-reusable worklets only exist in the workflow. You cannot use a
non-reusable worklet in another workflow. After you create the worklet in the
Workflow Designer, open the worklet to edit it in the Worklet Designer.
When you use a worklet in a workflow, you can configure the same set of general
task settings on the General tab as any other task. For example, you can make a
worklet reusable, disable a worklet, configure the input link to the worklet, or fail
the parent workflow based on the worklet.
In addition to general task settings, you can configure the following worklet
properties:
After you create a worklet, add tasks by opening the worklet in the Worklet
Designer. A worklet must contain a Start task. The Start task represents the
beginning of a worklet. When you create a worklet, the Worklet Designer creates
a Start task for you.
To add tasks to a non-reusable worklet:
Use Event-Wait and Event-Raise tasks in a worklet like you would use workflows.
To use the Event-Raise task, you first declare a user-defined event in the
worklet. Events in one instance of a worklet do not affect events in other
instances of the worklet. You cannot specify worklet events in the Event tasks in
the parent workflow.
Related Topics:
Working with Event Tasks
When you edit a workflow or worklet, you can view the forward or backward link
paths to other tasks. You can highlight paths to see links in the workflow branch
from the Start task to the last task in the branch.
Related Topics:
Creating a Workflow
Nesting Worklets
You can nest a worklet within another worklet. When you run a workflow
containing nested worklets, the Integration Service runs the nested worklet from
within the parent worklet. You can group several worklets together by function or
simplify the design of a complex workflow when you nest worklets.
You might choose to nest worklets to load data to fact and dimension tables.
Create a nested worklet to load fact and dimension data into a staging area.
Then, create a nested worklet to load the fact and dimension data from the
staging area to the data warehouse.
You might choose to nest worklets to simplify the design of a complex workflow.
Nest worklets that can be grouped together within one worklet. To nest an
existing reusable worklet, click Tasks > Insert Worklet. To create a non-reusable
nested worklet, click Tasks > Create, and select worklet.
Worklet variables are similar to workflow variables. A worklet has the same set of
predefined variables as any task. You can also create user-defined worklet
variables. Like user-defined workflow variables, user-defined worklet variables
can be persistent or non-persistent.
Related Topics:
Working with Workflow Variables
For example, you have a worklet with a persistent variable. Use two instances of
the worklet in a workflow to run the worklet twice. You name the first instance of
the worklet Worklet1 and the second instance Worklet2.
When you run the workflow, the persistent worklet variable retains its value from
Worklet1 and becomes the initial value in Worklet2. After the Integration Service
runs Worklet2, it retains the value of the persistent variable in the repository and
uses the value the next time you run the workflow.
Worklet variables only persist when you run the same workflow. A worklet
variable does not retain its value when you use instances of the worklet in
different workflows.
For each worklet instance, you can override the initial value of the worklet
variable by assigning a workflow variable to it.
Use the following rules and guidelines when you work with worklet variables:
You cannot use variables from the parent workflow in the worklet.
You cannot use user-defined worklet variables in the parent workflow.
You can use predefined worklet variables in the parent workflow, just as you use
predefined variables for other tasks in the workflow.
You can update the values of variables before or after a worklet runs. This allows
you to pass information from one worklet to another within the same workflow or
parent worklet. For example, you have a workflow that contains two worklets that
need to increment the same counter. You can increment the counter in the first
worklet, pass the updated counter value to the second worklet, and increment the
counter again in the second worklet.
You can also pass information from a worklet to a non-reusable session or from a
non-reusable session to a worklet as long as the worklet and session are in the
same workflow or parent worklet. For more information about passing information
between sessions, see Assigning Parameter and Variable Values in a Session.
You can assign variables in reusable and non-reusable worklets.
You can update the values of different variables depending on whether you
assign them before or after a worklet runs. You can update the following types of
variables before or after a worklet runs:
You assign variables on the Variables tab when you edit a worklet.
You can assign variable values in a worklet to pass values from one worklet to
any subsequent worklet in the same workflow or parent worklet. For example, a
workflow contains two worklets wklt_CreateCustList and wklt_UpdateCustOrders.
Worklet wklt_UpdateCustOrders needs to use the value of a worklet variable
updated in wklt_CreateCustList.
Configure worklet wklt_UpdateCustOrders to use a worklet variable, for
2.example, $$URLString2.
Configure the workflow to use a workflow variable, for example, $
3.$PassURLString.
Configure worklet wklt_CreateCustList to assign the value of worklet variable $
$URLString1 to workflow variable $$PassURLString after the worklet
4.completes.
Configure worklet wklt_UpdateCustOrders to assign the value of workflow
variable $$PassURLString to worklet variable $$URLString2 before the worklet
5.starts.
Related Topics:
Using Worklet Variables
User-Defined Workflow Variables
Assign variables on the Variables tab when you edit a worklet. Assign values to
the following types of variables before or after a worklet runs:
Validating Worklets
The Workflow Manager validates worklets when you save the worklet in the
Worklet Designer. In addition, when you use worklets in a workflow, the
Integration Service validates the workflow according to the following validation
rules at run time:
You cannot run two instances of the same worklet concurrently in the same
workflow.
You cannot run two instances of the same worklet concurrently across two
different workflows.
Each worklet instance in the workflow can run once.
When a worklet instance is invalid, the workflow using the worklet instance
remains valid.
The Workflow Manager displays a red invalid icon if the worklet object is invalid.
The Workflow Manager validates the worklet object using the same validation
rules for workflows. The Workflow Manager displays a blue invalid icon if the
worklet instance in the workflow is invalid. The worklet instance may be invalid
when any of the following conditions occurs:
The parent workflow or worklet variable you assign to the user-defined worklet
variable does not have a matching datatype.
The user-defined worklet variable you used in the worklet properties does not
exist.
You do not specify the parent workflow or worklet variable you want to assign.
For non-reusable worklets, you may see both red and blue invalid icons
displayed over the worklet icon in the Navigator.