Skip to main content

Technology Partners

TIBCO – Exception Handling

Http Receiver

Exception handling is the process of responding to the occurrence of exceptions. Exceptions are one of the scenarios that all developers are supposed to deal with. While developing business processes in TIBCO designer, a large number of possible exception types may come across in your way which require your attention.

Step 1: Create a Process with HTTP Receiver as Process Starter

An input parameter ‘name’ is given.

 

Http Receiver

HTTP receiver will start the activities. Created HTTP Connection with host as localhost and port as 8900 for this example. It reads files to store the XML data. Has JDBC update activity. Catch activity to catch the exceptions and finally HTTP response activity to respond to success.

Step 2: Configure Read File Activity

In the example, I have read files from my Desktop. In the HTTP request, whatever data is sent in the name parameter will be used to find from the given directory. I have created a file with my given name.

Concatq1

So if the user sends prathyussha as a parameter in the name area, it consists and finds file as prathyussha.xml.

Step 3: Parsing XML

The data from the read data resource is now sent to Parse XML because it needs to do parsing and send it as text form to JDBC.

Parse Parse 1

The schema is set to capture the data and send it to the JDBC update.

Step 4: Configure JDBC Update Activity 

After reading content from the XML file, it will be stored into a database table in our example. For this, we need to configure JDBC Update activity as shown below

Jdbc Activity Update

They are now sent to the JDBC update to store them into the database.

I have generated Error handling in two ways :

  • Inside the group block,  have added generate error block which gives us a specified custom error. The custom error is then thrown.
  • And we use Catch resources inside the block.

Step 5: Configure Catch Activity to Catch FileNotFound Exception:

Suppose, if we want to use catch resource inside a group,  the successful transition will contain following Xpath

Catch File

Step 6: Configure Send HTTP Response activity

In this scenario, there are three examples where we need to send an Http request.

  1. When operation gets successful
  2. When an exception is thrown and is caught properly
  3. When an exception is thrown but not handled explicitly

Http Success

If the operation is successful we will send Operation success in transition.

Success Transition

When FileNotFound exception is thrown and caught, Send HTTP Response activity is configured as shown below:

Http Error

Sending a back error message to display.

Http Error Resp

For all other exceptions which are unhandled are caught here in this catch resource.

Catch All

 

Testing scenarios : 

  1. Testing Success Scenario
  2. Testing File Not Found Exception Scenario by Catch inside the group.
  3. Testing File Not Found Exception Scenario by using custom generated error.
  4. Testing Unhandled Exception Scenario

 

  • Testing Success Scenario:

We have the file stored in name prathyussha.xml in my C:\Users\prathyussha.ravi\Desktop\TIBCO\xml where we will read this and store it in the Oracle database.

Success

 

Database

  •      Testing File Not Found Exception Scenario by Catch inside the group.

Database

If the file is not found, the catch resource will be executed.

Database

In case if there is any exception which is not caught inside the group,

Database

  • Testing File Not Found Exception Scenario by using custom generated error.

By using generate error if there is an exception we can generate a customized error.

Database

Customized error message printed in the message area.

Database

 

Database

 

  • Testing another scenario:

We will do other types of error in JDBC so that it is caught in unhandled catch resource.
Error In Jdbc

Database

Thoughts on “TIBCO – Exception Handling”

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Prathyussha Ravi

Prathyussha is a Full Stack developer based out of Chennai, India. She is trained in TIBCO and TIBCO BW (integration).

More from this Author

Follow Us