In this JCA Error Handling Part 1 we will learn the basic understanding of the jca errors,configuring Rejection Handlers by creating fault policies to handle them, and also ways to check this error messages
Rejected Messages
The
messages that error out before being posted to the service infrastructure are referred
to as rejected messages.
For
example, the Oracle File Adapter selects a file having data in CSV format and
tries to translate it to XML format (using NXSD). If there is any error in the
translation, this message is rejected and is not be posted to the target
composite.
Primarily, adapters and binding components are the generators of
rejected messages. Adapters reject messages that error
out at the binding level; that is, they error out before entering the Service
Infrastructure layer. All
rejected messages are stored in the Database with the payload. The rejected messages
can later be queried against.
Configuring
Rejection Handlers
In the
10.x release, rejection handlers were defined in the deployment descriptor (bpel.xml)
of an Oracle BPEL process.
In the 11g
release, you must define rejection handlers by using fault policies. (You
can specify only one action handler for inbound rejection handlers.)
Creating
Fault Policies
You must
create two files named fault-policies.xml
and fault-bindings.xml, and copy
them to the SOA project directory in JDeveloper
STEP.1: Define a fault policy for the rejected
messages in the fault-policies.xml file,
stored with the composite.xml file in the JDeveloper project directory, as
follows
<?xml version="1.0" encoding="UTF-8"?>
<faultPolicies>
<faultPolicy version="2.0.1"
id="RejectedMessages">
<Conditions>
<!-- All the fault conditions are defined
here -->
<faultName
xmlns:rjm="http://schemas.oracle.com/sca/rejectedmessages" name="rjm:<SERVICE_NAME>">
<!-- local part
of fault name should be the service name-->
<condition>
<action ref="writeToFile"/>
<!-- action to be
taken, refer to Actions section for the details of the action -->
</condition>
</faultName>
</Conditions>
<Actions>
<!-- All the actions are defined here -->
<Action id="writeToFile">
<fileAction>
<location>/tmp/rej_msgs</location>
<fileName>emp_%ID%_%TIMESTAMP%.xml</fileName>
</fileAction>
</Action>
</Actions></faultPolicy>
</faultPolicies>
STEP.2: You must associate the fault policy
with a service endpoint of the composite in fault-bindings.xml.
<faultPolicyBindings version="2.0.1"
xmlns="http://schemas.oracle.com/bpel/faultpolicy"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
<service faultPolicy="RejectedMessages">
<name>Read</name>
</service>
...
</faultPolicyBindings>
STEP.3: Copy the fault-policies.xml and the fault-bindings.xml
files to your SOA composite project directory.
STEP.4: Deploy the SOA composite project.
Note:
If you do not configure rejection handlers as
mentioned, a default file-based rejection handler starts processing and the
rejected messages is directed to <domain_home>/rejmsgs/<wls_server_name>/<composite_name>.
Also, you
can configure rejected messages with a Mediator Component in the same fault
policy as that of Oracle BPEL Process Manager
(Oracle BPEL PM).
Checking
for Rejected Messages: You
can check for rejected messages by using either of the following steps.
1.
Checking from the Database
To check
from the database, you must connect to the database as soainfra schema, and run
the following SQL command:
select * from rejected_message
2.
Checking from the Fusion Middleware Control Console
You can
view the rejected messages in the Recent Faults and Rejected Messages section
of the Dashboard tab or in the Faults and Rejected Messages tab.
0 comments:
Post a Comment