View
213
Download
0
Category
Preview:
Citation preview
Work Flows
Done BySendhil AnnamalaiSanghamitra Das
Nandini T. GopinathSanjeev U.N.
Sunil B Varghese
What is an workflow
It is an activity involving the coordinated execution of multiple tasks performed by different processing entities.
A
B
C
C D1
2
3
4
5
Our Goal
The user should be able to specify certain constraints in the workflow.
Our layer should be able to enforce those constraints.
Types of constraints Dependency (inter and intra workflow) And Or Mutually Exclusive (on ID, on Component,
on Workflows)
Middleware : Event Channel
Push driven Real time event channel. Uses object oriented techniques (Java). The event channel defines supplier and
consumer participants.
For our project we are using the event channel to pass the events between two components of a workflow.
Push Consumer Push Consumer Push Consumer
Consumer Proxy Consumer Proxy Consumer Proxy
Supplier Proxy Supplier Proxy Supplier Proxy
Push Supplier Push Supplier Push Supplier
Dispatcher Consumer Admin
Supplier Admin
WORKING OF THE EVENT CHANNEL
Some assumptions
Reliability. Each component works on a single ID at a time. Mutual exclusion sets are disjoint AND receiver gets the same ID from both sides. send(event) is the last statement of execution in
a component.(i.e. No execution on the same ID occurs after a send has been done).
In writing the XML file all rules and constraints are followed.
Architecture
Event Channel
TAM
- Constraint Data Structure
-Reference to Stubs
B
A
C
D E
Stub A
Stub B
Stub C
Stub D
Stub E
Stub A
Functions TAM Reads the XML file with the constraints. <wf-definition>
<wf-names><workflow> <workflow-name> A </workflow-name>
<wf-components> <wf-component> C1</wf-component> <wf-component> C2</wf-component>
</wf-components> </wf-names>
</wf-definition>
<wf-specification> <wf-dependency> <wf-name> A </wf-name>
<dep> <dep-name> dep1 </dep-name> <dep-def> <dep-comp> C1 <dep-comp>
<dep-event> E1 </dep-event> <dep-result>C2 </dep-result>
</dep-def> </dep> </wf-dependency> </wf-specification>
Creates a data structure which maintains the constraints
Work Flow 1
Work Flow 2
Component A Component DComponent CComponent B
Component C Component B
Workflows and Components hold the condition objects
DEP A,1 AND B,C
Component E
OR C,B
Mutual Exclusion
Mutual Ex. (B,C)
Mutual Ex.
(C,B)
A|
B|
C|
D|
C|
B|
E|
Creates the stubs.
There is a stub associated with each component. Each stub holds a supplier (If its corresponding
component sends events) Each stub holds a consumer (If its corresponding
component receives events) Each component interacts only with the stubs to
send/receive events. Each stub informs the TAM each time it has
published an event Each stub checks with the TAM if it can call the
receive of the component.
Component A
Stub AComponent A
Stub A
send(event)receive(event)
Event Channel
Inform TAM
push(event)
Check with TAM
push(event)
Component and Stub Interaction
How TAM takes care of constraints
TAM has a constraint object for each type of constraint which can be specified in the constraint file.
When a component calls the send method of its stub,it first informs TAM that it is going to send the event,
then the stub calls the push method of its supplier. When a stub receives an event from the event
channel, it checks with TAM to see if it can deliver it to its component.
‘Dependency’
When the stub of component B gets event 2, it will inform TAM about the receipt of the event.
TAM will return a true to the stub to go ahead with the delivery (if there are no other constraints).
If any other constraint exists like mutual exclusion, TAM returns a false and the event header is stored in the dependency object.
On receiving false the stub will buffer the event in its queue till further notification from TAM.
Component A
Component B2
‘Or’ constraint
Component A
1
2
3
The component in the TAM data structure holds the OR object.
1. TAM will receive a request from the Stub of Component A when it has received Event 1 whether it can deliver the event to the component.
2. TAM will reply with a true (if there is no other constraint). 3. TAM will again receive a request from Stub A when it has
received event 2. It returns a true (if there is no other constraint) to the Stub.
TAMStub A
A
Event Channel
1
Request to Deliver
True
2
‘OR’ constraint (contd..)
1 2
‘And’ constraint
Component A
1
2
3
The component in the TAM data structure holds the AND object.
1. TAM will receive a request from the Stub of Component A when it has received Event 1 whether it can deliver the event to the component.
2. TAM will reply with a false and will set a field in the constraint object indicating the receipt of event 1. The stub buffers the event on receiving a false.
3. TAM will again receive a request from Stub A when it has received event 2. It returns a false to the Stub, the event gets buffered in the stub.
4. TAM will now send an indication to Stub A to deliver both event 1 and event 2 to its component.
TAMStub A
A
Event Channel
1
Request to Deliver
Deliver 1 and 2
Set event in constraint
object
2
‘And’ constraint (contd..)
1 & 2
Mutual Exclusion
Mutual exclusion objects are held by components or workflows1. The mutual exclusion object holds the set of
components/workflows which may not execute simultaneously.2. When the receiver stub requests TAM permission to forward an
event to the external receiver component, if the TAM finds a mutual exclusion object with the associated internal receiver component, it checks if any of the members of the exclusion set is active.
3. If so, it forwards the components to the mutual exclusion object of the executing member.
4. When the executing member finishes, the list of components blocked are returned to the TAM.
5. TAM allows the first receiver stub within the list returned to execute and stores the rest of the blocked components in its associated internal receiver component.
Mutual Exclusion within a workflow (between components)
Each component maintains a mutual exclusion object with the same exclusion set
The component with the mutual exclusion that is currently executing maintains a list of blocked component names.
In the case of mutual exclusion between components based on ID, TAM checks, the ID being processed and the status of the other components in the mutual exclusion set.
TAMStub A
A
Event Channel
1Request to Deliver
Forward B
Check for active Mutual
Exclusion Components
Mutual Exclusion (contd..)
Stub B
B
Return B
Execute Deliver 1
Mutual Exclusion at workflow level on a ID
In this case, a workflow has processing on an ID only at one of its components.
Two workflows can also be mutually exclusive with each other
Advantages of TAM
Workflow and component level constraints are taken care of in the TAM layer.
Components can be coded independently without having to worry about decision making.
Uses an XML file to specify constraints (parsers already available)
Workflow goes ahead even if some components fail.
Disadvantages of TAM
Decision making is centralized. Synchronized manager. Can’t change the data-structure
dynamically.
A scenario
Component
A
Component
B
Component
C
Component
D
Component
E
1
2
3
4
5
- Component D has an and condition. Event 5 can go ahead only if it has received event 3 and 4
-The workflow will also have a constraint of mutual exclusion on an ID.
The xml file to specify this workflow
<wf-definition>
<wf-names><workflow>
<workflow-name>WF1</workflow-name> <wf-components> <wf-component> Component A</wf-component> <wf-component> Component B</wf-component> <wf-component> Component C</wf-component> <wf-component> Component D</wf-component> <wf-component> Component E</wf-component>
</wf-components><workflow>
</wf-names> </wf-definition>
The xml file
<wf-specification><wf-dependency> <workflow-name>WF1</workflow-name><dep> <dep-name> DEP1 </dep-name> <dep-defn>
<dep-comp> Component A <dep-comp> <dep-event> Event1 </dep-event>
<dep-result> Component B</dep-result> </dep-defn> </dep> <dep>
<dep-name> DEP2 </dep-name> <dep-defn>
<dep-comp> Component A <dep-comp> <dep-event> Event2 </dep-event>
<dep-result> Component C</dep-result> </dep-defn> </dep>
<and-cond> <cond-param> <cond-comp> Component B</cond-comp> <cond-event> Event3 </cond-event> </cond-param>
<cond-param> <cond-comp> Component C</cond-comp> <cond-event> Event4 </cond-event> </cond-param>
<cond-result> Component D</cond-result>
</and-cond>
The xml file
The data structure which TAM makes to store all these constraints
Work Flow 1
ComponentA
ComponentD
ComponentC
ComponentB
ComponentE
AND B,C
3,4
DEP A, 1 DEP A, 2 DEP D,5
MutualExclusionID
Dummy
Logical representation of the data structure.
Work Flow 1
Component
A Component
C
Component
B Component
D
Component
E
Holds an AND object
Holds a DEPENDANCY
object
Holds a DEPENDANCY
object
Holds a DEPENDANCY
object
Holds a MutualExclusionID
object
Dummy
The stubs created.
Component
A
Component
B
Component
C
Component
D
Component
E
1
2
3
4
5
Stub A
Stub B
Stub C
Stub D Stub E
Holds a supplier which will publish event types 1 and 2
Holds a Consumer for the event which the Dummy sends.
Holds a supplier which will publish event type 3.
Holds a consumer which will subscribe to event type 1
Holds a supplier will publish event type 4.Holds a consumer which will subscribe to event type 2
Holds a supplier will publish event type 3.Holds a consumer which will subscribe to event type 1
Holds a consumer which will subscribe to event type 5
Dummy
Dummy
Send
Publish
Recieve
Recieve
Questions ?
Recommended