Index Changes
This is version 5. It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]
Introducing Variables and Expressions into WLMSE is to allow the elements (Assignment, Escalation, Timeout, etc) in task definition and properties of task instance (Priority, Title, etc) to be dynamically derived from input message.

Variables

Internal Variables

Three Internal variables are provided by WLMSE: TaskInput, TaskOutput and TaskInstance.Owner. TaskInput automatically holds the single element of input message received from BPEL that triggers the task instance creation1. TaskOutput variable holds the output message to be returned to BPEL when task completes, initially it is an empty element. TaskInstance.Owner is automatically assigned by WLMSE when a user claims the task. $TaskInput and $TaskInstance.Ownerare read-only variables

Note: Currently, we only support single part which is an element for input message
Note: User can use Mapper to create xpath in Init and Action/ChangeVariables, but tooling to use xpath in Assignment, Escalation, Notification, etc is yet to be added, user will need to type the xpath starting with "="

Task Initialization

Task initialization section on task definition (.wf) file is optional, it consists of variable definitions and initialization.

<init>
	( <variables>
		...
	  </variables>) ?
	
	( <variable-init>
	     ...
	  </variable-init> ) ? +
	
/init>

<variable-init> initializes a variable by assignment, similar to BPEL's assignment

<variable-init>
	(<copy>
		<from>VariableXpathExpression</from>
		<to> VariableXpathExpression</to>
         </copy>
	)+
</variable-init>

VariableXpathExpression takes the form : $VariableName.partName{/Xpath expression}, for $TaskInput and $TaskOutput, partName can be omitted because $TaskInput and $TaskOutput always contain only one part, but Mapper supports xpath in the form of $VariableName.partName{/Xpath expression} only, thus it is the preferred to have partName

An example is to assign orderId from the input message to the output message to initialize the output message

<variable-init>
		<copy>
			<from>$TaskInput/orderId</from>
			<to>$TaskOutput/orderId</to>
		</copy>
</variable-init>
The binding of WLM variable to Xpath is similar to what BPEL does, the default xpath support is Xpath 1.0

Note: The variable initialization happens before the task is created and the variable once assigned can not be changed

Dynamic Assignment, Timeout & Escalation

Variables can be used in Assignment, Timeout & Escalation, for example, the user comes from the TaskInput variable:
	<assignment>
            <user>$TaskInput.part1/users</user>
            <group>$TaskInput.part1/groups</group>
        </assignment>

multiple users/groups can be obtained as a collection returned by the xpath, for example:

  
      <sampleInput>
           ....
	<users>
                Mary
        </users>
	<users>
                John
        </users>

      </sampleOutput>

When the input message is above, using $TaskInput.part1/users in assignment as <assignment><user>$TaskInput/users</user></assignment> also result in two assignees: Mary and John

The same rule applies to group.

The duration and deadline expression Timeout & Escalation can come from input message too, for example:

  
      <sampleInput>
           ....
	<deadline>
                '2007-12-01T23:00:00Z'
        </deadline>

     </sampleOutput>


        <escalation>
            <deadline expressionLanguage="xpath">$TaskInput.part1/deadline</deadline>
            ... ...
        </escalation>


Literals

Literals are constants expression with no variables. To indicate an expression is literal, the expression must be surrounded by quotes , for example:

        <escalation>
            <deadline expressionLanguage="xpath">'2007-12-01T23:00:00Z'</deadline>
            ... ...
        </escalation>

	<assignment>
            <user>'Mary'</user>
            <user>'John'</user>
            <group>'CustomerServiceRep'</group>
        </assignment&gt

Use Case

Use Case 1: A purchase order received by BPEL, BPEL checks the purchase order's customer id, if it is a large account, assigns the High priority to the input message priority part, and changes the assignees part to a large account manager. If else, the priority is Normal and another assignee group is assigned.

Conditional language such as if-then-else

Conditional language will be supported later. Although we do not want to duplicate BPEL's constructs into WLMSE to be make it unnecessarily complex, we may need it for adding/removing escalation/timeout constructs dynamically.

we could use xpath 2.0 if else expression which will allow us to use if else without introducing if else constructs in task definition.

http://www.w3.org/TR/2003/WD-xpath20-20030502/#id-conditionals

Implementation notes

Currently, as the variables do not change values during the life span of the task, they are not persisted. Every time the task is recreated from DB, it goes through the init process to initialize variables. Thus, no special treatment is needed for recovery

JSPWiki v2.4.100
[RSS]
« Home Index Changes Prefs
This particular version was published on 13-Feb-09 14:09 PM, -0800 by MeiWu