Catch Me If You Can

Posted by Knut Vatsendvik on Oracle Blogs See other posts from Oracle Blogs or by Knut Vatsendvik
Published on Wed, 14 Apr 2010 22:26:42 +0000 Indexed on 2010/04/14 22:33 UTC
Read the original article Hit count: 452

Filed under:

Suppose you have a Proxy based Web Service using Oracle Service Bus. In a stage in the request pipeline, 
you are using a Publish action to publish the incoming message to a JMS queue using a Business Service. What if the outbound transport provider throws an exception (outside of your pipeline)? Is your pipeline able to catch the error with an error handler??

This situation could occur because of a faulty connection, suspended queue, or some other reason. Here is the Request Pipeline in our simple test case.

Publish Message 2

With an Error Handler added to the message flow containing a simple Log action.

Error Handler

By default, the Publish action will invoke the service in a fire and forget fashion. Therefore any exception that occurs in the outbound transport will go unnoticed as shown in the following Invocation Trace.

Invocation Trace - No Catch

So what now? In a message flow, you can apply a Routing Options action to modify any or all of the following properties in the outbound request: URI, Quality of Service, Mode, Retry parameters, Message Priority.

Now add the Routing Options action to the Request Action as shown below.

Publish Message

Click the Routing Options to display its properties in the Properties View. Select the QoS option to set the Quality of Service element. Select Exactly Once to override the default setting, and Republish the project. The invocation will now block until the message is completely processed.


QoS

Trying the same test case as earlier generates the following Invocation Trace showing that the Error Handler is now triggered.

Invocation Trace - Service Error Handler

© Oracle Blogs or respective owner