Monday, August 24, 2015

IBM BPM UCA - Consume & Durable Subscription

Consume and Durable Subscription Options Usage on UCA  (IBM BPM ):-
Durable Subscription:-
Think Our BPD is like this:-
                                                            
Start Event----->Parallel Gateway--------------> MIE1(Message Intermediate event(configured 
                                                  !                         MyUCA1))------------->Scrpit1---------->end
                                                  !                          
                                                  !
                                                  !----------->      MIE2(Message InterMediate event(Configured    
                                                                          MyUCA1))-- ----------------->Script2------------>end
                                                                      
Human Service:-(fireMyUCA1 human Service)
Start------------->Invoke UCA(Configured MyUCA1) -------->end
Testing:-
case1:-
1)If we start BPD instance  .Then flow waits at MIE1,MIE 2 .
2)If we run fireMyUCA1 Human Service.Then both MIE1,MIE2 will trigger and instance will be completed success fully.
Case2:-
1) Check Durable Subscription option for MIE1 and Uncheck Durable Subscription option for MIE2.
2)Dont start BPD  .But Run ” fireMyUCA1” human Service.
3)Now Start the BPD.Go to inspector  view,Flow only waits at MIE2 only because MIE1 automatically fires because Durable Subscription option was checked .If you want fire MIE2 again you have to run fireMyUCA1 human  service.
Observations:-We are checked Durable Subscription option for MIE1 means .If any of  event fired(Which related MIE1) before flow reached MIE1 .That event persisted  and Once our flow come into active it will be fired .

“What if the event that would trigger the listener occurs before the listener is reached? This is where the concept of the Durable Subscription comes into play. If this flag is checked, then the arrival of an event before the listener is reached is remembered and when the process
reaches the Intermediate Message Event, it is immediately notified that the solution can continue. If this flag is not checked, then the event that arrived previously is discarded and the process will wait for a further event.”

Consume explanation:-
"Consume" means when an intermediate listener in a given Business Process instance correlates to a message, should it mark that message so that it will not be used by any other event listeners in that instance that are listening for the same event.  It is very important to note that this is a per instance flag.  The value on this flag has no between 2 listeners in separate BPD instances.  If a message is consumed, then the next time a listener begins listening it will only react to events that have not been consumed for this Business Process Instance.
Create two BPDs:
BPD1:-
MessageStartEvent(Configured with MYUCA1)---->MIE(Configured with MYUCA1)----->End  (Consume Option was checked)
BPD2:- MessageStartEvent((Configured with MYUCA1)---->MIE((Configured with MYUCA1)----->End      (Consume Option was Unchecked)
Testing:-
1)Create Human Service which will fire MYUCA1.Run service
2)Then Two instances were created (BPD1,BPD2).
3)Coming to BPD1 flow, instance   will wait at MIE step because ,StartMessageEvent was consumed the message .So MIE is waiting for another Message.(If you observe the BPD1 Instance status is in Active state).
4)coming to BPD2 flow  won’t wait it fires both events(MSE,MIE).(If you observe the BPD2 Instance status is complete )