Sunday, January 6, 2013

Creating your first BPM process

Implementing a BPM process involves many concepts. Here I am posting a step by step approach to create a simple BPM Process

As the first step create a BPM Application





Under the application create a BPM Project





In the next window choose the process type as Manual

The BPM project has two views. One is the regular project view and the second is the BPM view


Create two roles "creator" and "approver" which is required to perform human tasks


Using the Identify look up window associate the users to the above roles




Open the process and right click on the role and change the role to Creator



Below the first role, right click and add another role as shown below


Now the window will look like

Now drag the stop activity to the Approver line and add another human task from the  Component Palete


In the BPM view , right click on the business object and create a module called Order Module



Now create a business object under this module


Select the module we created in the above step and click OK



In the business object window add three attributes as shown below






Now select the process again and go to the structure window


Right click on the ProcessData Object and create a new process data object of the type defined in the business object which we created in the above step


Now right click on the CreateOrder activity and goto the implementation tab.

Create a new human task as shown below

In the parameter section click on the + button and drag and drop the process data object we created in the above step. Make the parameter editable

Say OK and in the Data association add the data mapping as shown below


Similarly for the ApproveOrder Activity add human task 

Now the process appears without any warning


For the two human task we created in the above step generate a UI using the CrateForm Option



Give the UI suffix for the project name

This will create a form as shown below. This form creation process will take few minutes to complete


Similary for the approve task as well create a UI



Now the project is ready to deploy. Goto Project view and deploy

Select the UI projects in the subsequent screen

Complete the deployment

Once deployment is completed log on to the bpm workspace as the Creator role. Here weblogic user having the creator role



The process will be displaced in the Applications list


Click on the process link and it will prompt with an order creation UI. The Creator can click on the submit button which will create the instance of the order and that will be assigned to the Approver to approve or reject




Now logout and login as Approver. Here admin user has Approver Role



Once logged in the Approver can see the pending task to approve or reject the order



Once the order is approved or rejected that item will get removed from the approver's task list

This completes the BPM sample execution


BPEL to OSB Transaction Propagation using SB Transport

How do we propagate the transaction from BPEL to OSB.

I am trying here a special use case



Ø  Place Message in the source queue

Ø  BPEL process consumes the message

Ø  BPEL then invokes a OSB proxy service

Ø  OSB proxy service invokes an OSB business service

Ø  OSB business service post the message to an outbound queue

If any error happens in the OSB layer, the transaction should roll back and the message has to be redelivered till the redelivery limit specified for the message. After the redelivery limit is reached the message should be stored in an error queue


Step 1

Create the following three queues in the weblogic domain

 1) MyDistributedQueue
 2) ErrorQueue
 3) TestOutQueue





Open MyDistiburedQueue and go to the tab "DeliveryFailure" and configure the ErrorQueue



Lets first do a positive test

1) Create BPEL Consumer Process which consumes message from the MyDistributedQueue
2) Create an OSB proxy service using SB Transport
3)OSB proxy then calls the OSB business service , which inturn send the message to the target queue.
4) Since SB Transport is used we need to use DirectBinding option from BPEL to call the OSB proxy service

OSB Proxy Service using SB Transport



OSB business service configuration


BEPL Process which consumes message from the source queue and calls the OSB Proxy Service




BPEL uses Direct Binding to invoke OSB ProxyService which uses SB Transport



Now post a message to the source queue

There is no error anywhere in the service and  BPEL consumes the message and send to OSB sucessfully



We can see the message in the target queue


Now lets simulate an error in the OSB Layer. Instead of an actual endpoint URI , change it to a wrong end point

Again post a message to the source queue


Now we can see the exceptions in the OSB logs


Now the transaction rolls back and the message is getting redelivered 3 times

Now in the target queue there wont be any message
Where as the message will be visible in the error queue configured for the source queue after the redelivery limit is reached
So by this approach the message is preserved in the error queue irrespective of  the error happened in BPEL layer or OSB layer

Monday, December 24, 2012

Message Reliability in OSB

Message reliability is one of the features which customer look for. OSB too provides options to preserve the message. Consider a typical scenario where in proxy service reads a message from a source queue and send that message to a target queue. Once proxy service picks up the message it will try to post the message to the target queue. If for any reason the target queue is not accessible or any failure happens during posting there is a chance to loose the original message if proper steps not taken.

To ensure message reliability OSB provides transactional support while configuring  the proxy service.

As the first step create a source queue(TestQueue) and a corresponding error queue(TestErrorQueue) for the source queue


Set the delivery failure option for the source queue - TestQueue

Create a proxy service to consume the message from the TestQueue and enable the transaction parameters as follows

Create a business service to post the message to target queue( To generate error I have configured  a fictitious server and queue)

Create a message flow to route the message to business service


Now post a message to the TestQueue. Set the Redelivery limit to 2



Now on the OSB console we can see message is getting retried 2 times








Each time when the business process try to post the message to the target queue on the remote server, it will fail and the transaction will roll back the message back to the source queue.


After the retry limit is reached the message will be removed from the TestQueue and will move to the TestErrorQueue





We can see the message content in the ErrorQueue. So in any case the original message is not lost . It is preserved for further action which can be automated or manual