Saturday, May 3, 2014

In previous post, we discussed about web service handler. In web service handler rejected message is handled by web service. In this post we will discuss about next error handler which is Advanced Queue error handler.

In Queue error handler rejected message is enqueued to advanced queue.

Please note that your AQ table type is RAW type otherwise you will see below error.

java.sql.SQLException: ORA-25215: user_data type and queue type do not match.

Follow below steps to use Advanced Queue error handler for rejected file.

Queue Error Handler

First you need to have advanced queue in oracle which will take the rejected message. Refer my previous post where I explain how to create advanced queue in Oracle.

For this post we will use below AQ and AQ table which we created in previous post.

Advanced Queue- SampleAQ
Advanced Queue Table - SampleAQTable

File Polling Service

We need to use Fault Handling Framework to configure the error handler so we need to have fault-binding.xml and fault-policies.xml file.

Create a new fault-binding.xml file in the same project and add below content to it.

<?xml version="1.0" encoding="UTF-8" ?>
<faultPolicyBindings version="2.0.1"
   <service faultPolicy="RejectedMessage">

Please note that “PollCustomerData” is name of the adapter that poll the file.

Now create a fault-policies.xml file where we add fault and required action.

For this error handler below is the format for the action.

<Action id="ora-queue">
  <enqueue uri="QueueURI"/> <!-- QueueURI format  -
jdbc:oracle:thin:@<host>:<port>:<sid>#<un>/<pw>#queue -->

Please add below content to fault-policies.xml file.

<?xml version="1.0" encoding="UTF-8" ?>
<faultPolicies xmlns="">
  <faultPolicy version="2.0.1" id="RejectedMessage">
      <!-- remote fault: -->
      <faultName xmlns:rjm=""
          <action ref="ora-queue"/>
      <!--Rejected Message to AQ-->
      <Action id="ora-queue">
        <enqueue uri="jdbc:oracle:thin:@localhost:1521:xe#sys as sysdba/oracle#SampleAQ"/>

Save your changes and deploy this composite to server.


Put file corrupted file to polling location. You should see new entry in SampleAQTable.

 Download code from here.

Next post explains about next error handler, File rejection Handler - Custom Java error handler for File Adapter.


Post a Comment