Saturday, 7 December 2013

Signalling In BPEL--Master & Detail Process

HI Guys

A BPEL process can communicate with another BPEL process just like it can communicatie with any Web Service – as BPEL processes expose WebService interfaces to the world – or at least to their fellow components in the same Composite Application. When one process – the master in tis discussion – calls another one – it can have several types of interaction and dependency on that other process – we will call it the detail process for the purpose of this article:
  • it is not interested at all in the detail process – its call was a one-way fire and forget
  • it is interested in the response and it will wait for the response before it can continue processing (synchronous calls will always do this, asynchronous calls could have some activity going on while the detail process is churning away)
  • it is interested in the fact that the detail process has reached a certain stage – but it does not actually need a response (it wants a signal but no data)
The Signal and ReceiveSignal activities are Oracle extensions to BPEL – that only work on the Oracle BPEL engine – that help us to implement the third scenario.
As part of the Invoke activity from a BPEL process to another process, we can specify that the called process should be considered a Detail process (and therefore the calling process as the Master process). When we have established this Master-Detail relationship, we can next create a Signal-ReceiveSignal connection between the two. These connections can be created in both directions: the Master sends a signal to the Detail (and the Detail waits to receive the signal) and vice versa the Detail process sends a signal that the Master is waiting for. Unfortunately, as we will see in this article, we cannot have multiple such interactions between a Master-and-Detail pair.
Typical use cases for the signal pattern are situations where a master process can only proceed when detail processes have completed or at least reached a certain state (the master process should only send the email to the customer when the detail process has handed the order to the shipping department) or when a master process calls a detail process to start processing and then needs to do some additional work before the detail process(es) can continue to their next step (master process asks detail to start gathering quotes from car rental companies, than continues to establish the credit-worthiness of the customer and when that has been taken care of indicates to the detail process that it may continue processing).
Note: there is nothing signal .and receiveSignal can do that we cannot also achieve using asynchronous, correlation driven calls. However, when we can achieve our goals using signaling, it is usually much easier to implement and lighter-weight to execute than the full blown correlation based solution.

Master and Detail Process Coordination Responsibilities
If A... Contains A... Then...
Master process Signal activity The master process signals all of its associated detail processes at runtime.
Detail process Receive signal activity The detail process waits until it receives the signal executed by its master process.
Detail process Signal activity The detail process signals its associated master process at runtime that processing is complete.
Master process Receive signal activity The master process waits until it receives the signal executed by all of its detail processes.



To create a master process:

In the SOA Composite Editor, create a BPEL process service component. For this example, the process is named MasterProcess.
Double-click the MasterProcess BPEL process.
In the Component Palette, expand BPEL Activities.
Drag a Signal activity into the designer
Double-click the Signal activity.
This activity signals the detail process to perform processing at runtime.



 Click OK.
Drag a Receive Signal activity into the designer.
Double-click the Receive Signal activity.
This activity enables the master process to wait until it receives the signal executed by all of its detail processes.
  
The master process has now been designed to:
  • Signal the detail process to perform processing at runtime.
  • Wait until it receives the signal executed by the detail process.

    How to Create a Detail Process

    To create a detail process:
    In the SOA Composite Editor, create a second BPEL process service component. For this example, the process is named DetailProcess
    Double-click the DetailProcess BPEL process
    Drag a Receive Signal activity into your BPEL process service component
    Double-click the Receive Signal activity.
    This activity enables the detail process to wait until it receives the signal executed by its master process.





    Click OK
    Drag a Signal activity into the designer
    Double-click the Signal activity.
    This activity enables the detail process to signal its associated master process at runtime that processing is complete








    Click OK.
    The detail process has now been designed to:
    • Wait until it receives the signal executed by its master process.
    • Signal the master process at runtime that processing is complete.

     

    To create an invoke activity:

  • Return to the MasterProcess master process.
  • Drag an Invoke activity into your BPEL process service component.
  • Double-click the Invoke activity.
  • Select the DetailProcess BPEL process you created in first Step as the partner link.
  • Complete all remaining fields in the Invoke dialog, and click OK.
  • In the designer, click Source.
Select the Invoke As Detail checkbox in the invoke activity.
 Specify the bpelx:detailLabel attribute for correlating with the receive signal activity
  1. <invoke name="MyInvoke" partnerLink="DetailProcess"
       portType="dp:DetailProcess" 
       operation="initiate"
       inputVariable="detail_input"/>
       bpelx:detailLabel="detailProcessComplete0"
       <bpelx:invokeAsdetail name="true"/>
    

HappyLearning

                         
                                                                                                                By DeepthiReddy

No comments:

Post a Comment