This documentation is work in progress and will be released with the next WSO2 EI version.
Step 2 - Creating the Asynchronous Process - WSO2 Enterprise Integrator 6.x.x - WSO2 Documentation

All docs This doc
||
Skip to end of metadata
Go to start of metadata

If the loan approval process involves another process, in which the response takes too long to respond, you can use an Asynchronous Process to implement it. This allows you to continue the rest of the process flow without waiting for the response.

Let's get started! Follow the instructions in the below sections to complete the BPEL Workflow you created in Step1 with the As ynchronous Process as shown below.

If you did not follow Step 1 - Creating the Synchronous Processes yet, you can import the pre-packaged project of it and continue by following the steps in this Tutorial. Follow the steps below to import it to WSO2 Integration Studio.

  1. Open the WSO2 Integration Studio, click File, and click Import
  2. Expand the WSO2 category and select Existing WSO2 Projects into workspace, click Next and upload the pre-packaged project



Adding the Sequence element

  1. Open the WSO2 EI Integration Studio.
  2. Right click on the replyOutput element, click Insert Before and click Sequence.


Configuring the InvokeLoanService element

  1. Right click on the Sequence element, click Add and click Invoke.

  2. Click on the Invoke element you added inside the Sequence element, and enter  InvokeLoanService as the Name in the Description section of the Properties tab.

  1. Click on the InvokeLoanService  element, click the drop-down arrow of  Partner Link  and select  Create Global Partner Link.  in the  Details  section of the  Properties  tab.

  2. Enter LoanPL as the  Partner Link Name  and click  OK .

  3. Select  From Project  as the type of the Partner Link, select  LoanServicePT  in the  Matches  field and click  OK .

  4. Click OK in the message, which pops up next to set the prefix of the namespace.

Adding the Partner Role

  1. Select the LoanServiceRole partner role and click OK .

    You need to invoke the getLoanOffer process. Therefore, this selects the LoanServiceRole, which includes the getLoanOffer operation.


Adding the Operation

  1. Once the partner link is created, double click on the getLoanOffer operation from the Quick Pick view. This automatically updates the input request.


    This will auto update the input/output of the Invoke step and creates the following variable.


Configuring the ReceiveLoanOffer element

  1. Right click on the Sequence element, click Add and click Receive.

    This creates a new Receive element to capture the result of the LoanService whenever it is sent back to the BPEL process.

  2. Click on the Receive element you added inside the Sequence element, and enter ReceiveLoanOffer as the Name in the Description section of the Properties tab.
     

Adding the Partner Role

You need to use the OnLoanOffer operation of the LoanServiceCallBackPortType partner role for the  ReceiveLoanOffer element. Therefore, follow the steps below to use the LoanPL partner link you created before for this  ReceiveLoanOffer element as well.

  1. In the Outline tab of WSO2 Integration Studio, click LoanPL under Partner Links.

  2. Select the following values in the Details section of the Properties tab.
    • My Role: LoanServiceClientRole
    • Partner Role:  LoanServiceRole
    • My Operations: onLoanOffer
    • Partner Operations: getLoanOffer

Adding the Partner Link

  1. Click on the ReceiveLoanOffer element, click the drop-down arrow of  Partner Link and select  LoanPL in the  Details section of the Properties  tab.

Adding the Operation

  1. Keep your cursor on the  Operation  field and double-click on onLoanOffer.

    This creates an input of the getLoanOfferResponse message type. You can find it in the Variables panel.




    This creates the LoanPLRequest1  variable.


  2. Double click on the  LoanPLRequest1  variable and rename it to  LoanPLResponse.

    This LoanPLResponse variable is the response from the LoanService to the BPEL process.

Configuring the Assign2 element

Right click on the Sequence element, click Insert Before and click Assign, to add the Assign2 element.

Mapping the variables

You need to map the required data received from the BankLoanProcessRequest message to the LoanPLRequest similar to the mapping you did before. Follow the steps below to do this.

  1. Click on the Assign2 element and click New in the Details section of the Properties tab.

  2. In the From box, expand the input :  BankLoanProcessRequestMessage and select payload : LoanRequest
     
  3. In the   To   box, expand the  LoanPLRequest :     getLoanOfferRequest and select part : LoanRequest.  

     
  4. Press Ctrl+S to save your artifacts.
  5. Click Yes in the message, which pops up to initialize the variables.   
     
  6. Follow the steps below to match the other variables.

    This creates variable to variable options to map each part of the CustomerInfo input (CustomerInfo:CustomerInfoType) to the corresponding part of CustomerPLRequest (part:CustomerInfo).

    1. Click New and select input: BankLoanProcessRequestMessage → payload : LoanRequest → CustomerInfo : CustomerInfo Type in the From  box and select LoanPLRequest :     getLoanOfferRequest → part :   LoanRequest → CustomerInfo : CustomerInfo Type  in the To  box.
       
    2. Press Ctrl+S to save the artifacts.
    3. Click New and select input: BankLoanProcessRequestMessage → payload : LoanRequest → CustomerInfo : CustomerInfo Type → Name : string in the From  box and select LoanPLRequest :     getLoanOfferRequest → part :   LoanRequest → CustomerInfo : CustomerInfo Type → Name : string   in the To  box.

       
    4. Press Ctrl+S to save the artifacts.
    5. Click New and select input: BankLoanProcessRequestMessage → payload : LoanRequest → CustomerInfo : CustomerInfo Type → Email : string in the From  box and select LoanPLRequest :     getLoanOfferRequest → part :   LoanRequest → CustomerInfo : CustomerInfo Type → Email : string   in the To  box.
       
    6. Press Ctrl+S to save the artifacts.
    7. Click New and select input: BankLoanProcessRequestMessage → payload : LoanRequest → CustomerInfo : CustomerInfo Type → CustomerID : CustomerIDType in the From  box and select LoanPLRequest :     getLoanOfferRequest → part :   LoanRequest → CustomerInfo : CustomerInfo Type → CustomerID : CustomerIDType   in the To  box.
       
    8. Press Ctrl+S to save the artifacts.
    9. Click New and select input: BankLoanProcessRequestMessage → payload : LoanRequest → CustomerInfo : CustomerInfo Type → CreditRating : int in the From  box and select LoanPLRequest :     getLoanOfferRequest → part :   LoanRequest → CustomerInfo : CustomerInfo Type → CreditRating : int   in the To  box.

    10. Press Ctrl+S to save the artifacts.

Configuring the Assign3 element

Follow the steps below to assign the values of the LoanPLResponse to the final output variable of the BPEL process.

  1. Right click on the Sequence element, click Add and click Assign.
     

Mapping the variables

  1. Click on the Assign3 element and click New in the  Details section of the  Properties tab .
  2. In the  From  box, expand the  LoanPLResponse : getLoanOfferResponse and select part : LoanOffer

  3. In the  To box, expand the output :  BankLoanProcessResponseMessage and select payload : LoanOffer

  4. Press Ctrl+S to save your artifacts.
  5. Click Yes in the message, which pops up to initialize the variables.  

  6. Follow the steps below to map the other variables.

    This creates variable to variable options to map each part of the  LoanPLResponse  input (i.e., LoanPLResponse : getLoanOfferResponse ) to the corresponding part of  LoanOffer  (i.e., payload : LoanOffer ).

    1. Click New and select LoanPLResponse : getLoanOfferResponse  → part : LoanOffer →  ProviderName : string  in the From  box and select output :  BankLoanProcessResponseMessage  → payload :   LoanOffer →  ProviderName : string   in the To  box.

    2. Press Ctrl+S to save your artifacts.
    3. Click  New  and select  LoanPLResponse : getLoanOfferResponse  → part : LoanOffer →  approved : boolean  in the From  box and select  output :  BankLoanProcessResponseMessage  → payload :   LoanOffer →  approved : boolean   in the To  box.

    4. Press  Ctrl+S  to save your artifacts.
    5. Click  New  and select  LoanPLResponse : getLoanOfferResponse  → part : LoanOffer →  AnualInterestRate : decimal  in the  From  box and select  output :        BankLoanProcessResponseMessage  → payload :   LoanOffer →  AnualInterestRate : decimal   in the To  box.

    6. Press Ctrl+S to save your artifacts.
    7. Click  New  and select Expression from the drop down in the From box, and type true().

    8. Press  Ctrl+S  to save your artifacts.
    9. Click New and select output : BankLoanProcessResponseMessage  → payload : LoanOffer →  selected : boolean  in the  To  box.

Configuring the replyOutput element

  1. Click on the replyOutput element and select client as the Partner Link in the Details section of the Properties tab.

  2. Select  process  as the Operation  in the   Details   section of the  Properties  tab.
  3. Double click  process  in the  Quick Pick  section to generate the input and output variables for this element.


  4. Press Ctrl+S to save the artifacts and their configurations.

After creating all the artifacts, you view the Design View of the BPEL Workflow as shown below.

Every Asynchronous Process requires a Correlation Set. Therefore, next, let's create a Correlation Set for the As ynchronous Processes  you created above. For instructions, see  Step 3 - Creating the Correlation Set .

  • No labels