FLOW Activity in BPEL Process

Introduction

In this article I will discuss about the FLOW activity in BPEL process. Here data will be copied from one xml file to another text file and database table. One file adapter will be in exposed service lane and one more file adapter & database adapter will be in reference lane. BPEL process will help you to achieve this example using Flow activity.

Flow activity in Asynchronous BPEL: Sometimes asynchronous BPEL process takes too long time to call each service at a time. If service call can happen through parallel flow, then BPEL process can invoke multiple web services at a time. This procedure is more efficient than a single service call one after another.

Flow activity in Synchronous BPEL: Synchronous BPEL process runs on a single thread, so all the branches in flow activity will execute sequentially instead of parallel.

  1. Create a new SOA application and SOA project with BPEL process. Here BPEL template type will be Define Service Later.FLOW_Activity_1
  2. Drag and drop a file adapter in the exposed service swim lane which will be used as input file source. Here file operation type will be Read File.FLOW_Activity_2
  3. Click on Next button. Select input file directory and file naming convention in the next wizard. You can select some advance options also for file adapter configuration. For file adapter configuration, refer this article. Select Employee.xsd as message schema. Download this .xsd file here.FLOW_Activity_3
  4. After file adapter configuration drag a wire between file adapter and BPEL process. Select persist as Delivery option. When BPEL process acts as one-way service then, delivery policy has following three options-
    • persist a�� Delivery messages persist in database table dlv_message
    • cache a�� Delivery messages are kept only in in-memory cache
    • Sync a�� Direct invocation on the same thread. If BPEL process is sync process then transaction attribute has two values a�� Required and RequiresNew
      • Required – This makes the BPEL process execute as part of the calling transaction. If no calling transaction exists, it will create a new one.
      • RequiresNew – This is the default value and makes the BPEL process execute as a separate transaction. Any existing transaction will be suspended.FLOW_Activity_4
  5. Then drag and drop database adapter in reference swim lane and configure DB adapter. Yu can refer this article for database adapter configuration. Enter database and JNDI connection details properly.FLOW_Activity_5
  6. Click on Next button and select operation type. Perform insert operation only.FLOW_Activity_6
  7. Now drag another file adapter in reference swim lane to write data from input file. Here file operation will be Write File. Select same Employee.xsd file in message schema.FLOW_Activity_7
  8. Double click on BPEL process to invoke the adapter services.FLOW_Activity_8
  9. Drag and drop a Receive activity at the beginning to receive input file.FLOW_Activity_9
  10. Double click on receive activity to open editor window. Enter a proper name of receive activity and select inputFile partner link. Create a variable for this activity. Select Create Instance checkbox also.FLOW_Activity_10
  11. Select Pick activity from component list and drag & drop it after receive activity.FLOW_Activity_11
  12. Add two Invoke activities in each sequence.FLOW_Activity_12
  13. Double click on invoke1 to open editor window of invoke activity. Select dbReference partner link and create an input variable of this invoke activity.FLOW_Activity_13
  14. Edit invoke2 also like below screenshot. Select outputFile partner link and create an input variable here also.FLOW_Activity_14
  15. Now Pick activity will look like this.FLOW_Activity_15
  16. Select XSLT Transform from Oracle Extensions component palette and drop it before each invoke activity.FLOW_Activity_16
  17. Edit transformation1 for database insertion. Select source as variable of receive activity and target as input variable of InvokeDBRef activity.FLOW_Activity_17
  18. Map the attribute values like below screenshotFLOW_Activity_18
  19. Edit transformation2 to create mapping between input file and output file adapter. Here source will be variable of receive activity and target will be input variable of InvokeOutFileFLOW_Activity_19
  20. Create wires between all the required values. Drag a wire from source side to target side and connect it.FLOW_Activity_20
  21. Save the project and BPEL process will look like below screenshotFLOW_Activity_21
  22. Deploy the project in server and test it. Keep a .xml file in input directory which is mentioned during input file adapter configuration and check the out directory.FLOW_Activity_22

Here BPEL process is asynchronous process, so FLOW activity works through parallel flow. Check the flow instance in EM console; you will be cleared about the parallel flow.

Leave a Reply

Your email address will not be published. Required fields are marked *

Show my latest post here