Work Flows

Work Flows
Done By
Sendhil Annamalai
Sanghamitra Das
Nandini T. Gopinath
Sanjeev 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.
B
3
1
C
A
2
C
4
5
D
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
Consumer Proxy
Consumer Proxy
Push Consumer
Consumer Proxy
Consumer Admin
Dispatcher
Supplier Admin
Supplier Proxy
Push Supplier
Supplier Proxy
Push Supplier
Supplier Proxy
Push Supplier
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
B
D
A
TAM
C
- Constraint
Data Structure
-Reference to
Stubs
Stub B
Stub D
Stub A
Stub C
Event Channel
Stub A
E
Stub E
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
A|
B|
C|
Work Flow 1
Component A
D|
Component B
Component C
Component D
DEP A,1
Mutual Ex.
(B,C)
AND B,C
Mutual Ex.
C|
B|
(C,B)
Work Flow 2
Component C
E|
Component B
Component E
Mutual Exclusion
Workflows and Components hold the condition objects
OR C,B

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 A
Component A
send(event)
receive(event)
Stub A
Inform TAM
Check with TAM
push(event)
push(event)
Event Channel
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’
Component A




2
Component B
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.
‘Or’ constraint
1
3
Component A
2
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.
‘OR’ constraint (contd..)
A
1 2
TAM
True
Stub A
Request to Deliver
1
2
Event Channel
‘And’ constraint
1
3
Component A
2
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.
‘And’ constraint (contd..)
A
1&2
TAM
Deliver 1 and 2
Stub A
Request to Deliver
1
Set event in
constraint object
2
Event Channel
Mutual Exclusion

1.
2.
3.
4.
5.
Mutual exclusion objects are held by components or workflows
The mutual exclusion object holds the set of components/workflows
which may not execute simultaneously.
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.
If so, it forwards the components to the mutual exclusion object of
the executing member.
When the executing member finishes, the list of components blocked
are returned to the TAM.
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.
Mutual Exclusion (contd..)
A
B
Execute
Deliver 1
TAM
Forward B
Stub A
Stub B
Return B
Check for active
Mutual Exclusion
Components
Request to Deliver
1
Event Channel
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
1
Component
B
Component
3
Component
A
D
2
5
Component
E
Component
C
4
- 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>
The xml file
<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 data structure which TAM makes to
store all these constraints
MutualExclusionID
Work Flow 1
Component
A
Component
B
Component
C
Component
D
Component
E
DEP A, 2
AND B,C
DEP D,5
Dummy
DEP A, 1
3,4
Logical representation of the data
structure.
Component
B
Work Flow 1
Dummy
Component
Holds a DEPENDANCY
object
A
Component
Holds a MutualExclusionID
object
C
Holds a DEPENDANCY
object
Component
Component
D
E
Holds an AND
object
Holds a DEPENDANCY
object
The stubs created.
1
3
B
Component
Dummy
Component
Component
A
Send
2
Recieve
Stub A
Recieve
Holds a supplier
which will publish
event types 1 and 2
Publish
Holds a Consumer
for the event which
the Dummy sends.
Component
E
D
Component
4
C
Stub B
Dummy
5
Holds a supplier which will
publish event type 3.
Holds a supplier will
publish event type 3.
Holds a consumer
which will subscribe to
event type 1
Stub D
Holds a consumer which will
subscribe to event type 1
Stub C
Holds a supplier will publish
event type 4.
Holds a consumer which will
subscribe to event type 2
Stub E
Holds a consumer
which will subscribe
to event type 5
Questions ?