« Java Embedding in BPEL Process | Main | Cloud Computing »

Searching BPEL process instances by business keys

Out of the Box Search Capabilities

BPEL Console provides several out of the box features for searching the process instances using multiple search criteria. Following are the main search criteria that can be used within BPEL console

clip_image002[4]

 

All the above are very powerful features for process administration.

Enterprise Integrations and Support

Enterprise integrations deal with business data and transactions. These integrations often have interactions between multiple layers. In case of a failed transaction at any layer, the support function personals can spend a great deal of time and energy on finding the issue and troubleshooting it. I wrote about this in one of my previous post "Service Oriented approach for ERP integration".

Now imagine a use case where thousands of messages are being processed every minute. Searching by some of the default criteria’s can result in multiple search results.

Lets take an example.

Custom Search Requirement Example

Lets assume that there is a BPEL process that processes orders in Oracle E-Business Suite. The order details are coming from an external application that is used by end users which in turn publishes to a JMS queue. The BPEL process picks up from the JMS queue and creates an Order in the EBS with the Order Number that comes from the message.

In the above example, if the end application does not receive an order confirmation, you can imagine there can be many reasons for that. One of them could be that the bpel process instance failed for some reason.

When it comes to tracking that order, the end application support will most likely call the support and mention that for this particular order (along with some sort of business key like the order number) there was no confirmation received.

In a production environment, there may be thousands of process instances. For our bpel support person to browse through the instances just by time can also take some time. But for him to be able to search the process instance by using a business key can prove to be extremely useful.

So the question from business user and administrator becomes

Can I search by Order Number?

The answer is YES.

Is there a simple way to do it?

Any one who has worked with application integration can relate to it and would agree with it. Now the question is Is there a simple way to do it?”

The answer is YES.

Let’s Do It

Let's build one simple bpel process from scratch and find out how can we achieve this highly desirable functionality

Step 1

Right Click on your application and select “New Project” option

Select BPEL Process Project

ScreenShot131

 

Step 2
Name the process “SearchableUsingCustomKeyProcess

ScreenShot128

Step 3

For simplicity we will proceed with the default option

ScreenShot129

Step 4

So now we have a skeleton asynchronous BPEL process

ScreenShot130

 

Step 5

Click on SearchableUsingCustomKeyProcess.xsd

 

ScreenShot133

 

Change the name of the input to orderNumber

ScreenShot132

 

Step 6

Drag and drop a Java Embedding activity from the Process Activities drop down on right hand side

Name it “JavaEmbeddingToSetProcessTitle”

ScreenShot137

 

Step 7

Double click Java Embedding you just added

Add the following code

 

ScreenShot139

 

Step 7

Deploy the process on server

Step 8

Initiate the process from BPEL console with “1001” as input to the orderNumber field

Notice the instance title is different than the process name. This is because of the setTitle statement in our Java Embedding.

 

ScreenShot141

Click on Audit Flow and then on the Java activity to make sure that the instance ran without any errors

ScreenShot144

 

Step 10

Let’s see if we can search by our custom field (order number) that we want to search for out of many bpel process intances in the console

Click on Instances

Now put the following into the Title field under Locate Instances and click “Go”

“OrderEntryBPELProcess - OrderNumber:1001”

clip_image002[6]

Notice how we are able to search for our particular order number (1001).

clip_image004[4]

You can search for other order numbers easily by just replacing the end of the string with the order number. For example searching for the following string within the title field will search for order number “2001”

“OrderEntryBPELProcess - OrderNumber:2001”

Summary

Requirements related to searching for a process instance in BPEL console by using a custom field could be addressed by the approach demonstrated in this post.

This example demonstrates that it can be done and it can be done easily.

Comments (8)

satish uppada:

hi, is there a way we can search for instance titles using wild card search ? say, i want to list all the orders starting with 1.

It would be great if console supports searching using %.

Peeyush Tugnawat:

You can build it using the APIs. One option can be to use the flex fields in BPEL PM and have a custom search page.

Charlie:

Can you do a wildcard search?

This post just takes advantage of the out of the box feature using a simple trick that lets you search by the process title.

You can always build more desirable search capabilities using the APIs. As I mentioned in my previous comment, one option can be to use the flex fields in BPEL PM and have a custom search page.

Balaji Natarajan:

Thanks! It's very useful.
How would it be, if i put these Java classes under ${ORACLE_HOME}/bpel/system/classes and invoke through WSIF binding? People are suggesting to use as a last resort. Correct me if i am wrong and also mention the pros/cons of using both ways in this situation.

Balaji Natarajan:

Please also tell us any references to building custom search using APIs.
Thanks
Balaji

Good question.

I would suggest using bpelx:exec when you are only planning to use small segment of java code. When it gets more than few lines, consider using WSIF binding or wrapping it as a SOAP service. Re-usability can also be enhanced when used across multiple bpel processes.

I can't remember any reference to a particular example or tutorial related to that . One good reference is the following section on bpel tutorial

http://download-west.oracle.com/docs/cd/B31017_01/integrate.1013/b28981/reports.htm

Also refer to the api documentation

Oracle BPEL Process Manager Client Java API Reference
http://download.oracle.com/docs/cd/B31017_01/integrate.1013/b28986/toc.htm

Oracle BPEL Process Manager Workflow Services API Reference
http://download.oracle.com/docs/cd/B31017_01/integrate.1013/b28985/toc.htm

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on February 6, 2009 9:37 AM.

The previous post in this blog was Java Embedding in BPEL Process.

The next post in this blog is Cloud Computing.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle