310 likes | 411 Views
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. 5. D. A.
E N D
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 5 D A C 2 4
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 Consumer Admin Dispatcher Supplier Admin Supplier Proxy Supplier Proxy Supplier Proxy Push Supplier Push Supplier 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 receivergets 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 E A • TAM • - Constraint Data Structure • Reference to Stubs C Stub B Stub D Stub E Stub A Stub C Event Channel 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 A| B| C| D| Component A Component B Component C Component D Work Flow 1 DEP A,1 Mutual Ex. (B,C) AND B,C Mutual Ex. (C,B) C| B| E| Work Flow 2 Component C Component B Component E Mutual Exclusion OR C,B Workflows and Components hold the condition objects
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 Component and Stub Interaction Check with TAM push(event) Inform TAM push(event) Event Channel
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 B 2
‘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. • 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. • 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. • 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. • 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 2 Set event in constraint object Event Channel
Mutual Exclusion • 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 Forward B TAM Stub A Stub B Return B 1 Request to Deliver Check for active Mutual Exclusion Components 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 Component B 1 3 Component A 5 Component E Component D Component C 2 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 Dummy DEP A, 1 DEP A, 2 AND B,C 3,4 DEP D,5
Logical representation of the data structure. Component B Component D Component E Component A Dummy Holds a DEPENDANCY object Work Flow 1 Component C Holds an AND object Holds a DEPENDANCY object Holds a MutualExclusionID object Holds a DEPENDANCY object
The stubs created. Component B 1 3 5 Component E Component A Component D Dummy Component C 2 Holds a supplier will publish event type 3. Holds a consumer which will subscribe to event type 1 4 Send Recieve Stub B Stub D Stub E Dummy Stub A Holds a supplier which will publish event type 3. Holds a consumer which will subscribe to event type 1 Recieve Holds a consumer which will subscribe to event type 5 Holds a supplier which will publish event types 1 and 2 Holds a Consumer for the event which the Dummy sends. Publish Holds a supplier will publish event type 4. Holds a consumer which will subscribe to event type 2 Stub C