Hi,
In this post, let us see how to handle rejected files.
File Adapters/ FTP Adapters which are used in scenarios where files are polled in SOA Suite, there are cases where corrupt or bad files can come or be present.
By default, File Adapter uses a default location to put rejected files as per the control directory which is configured in the Adapter configuration in weblogic. The instance is faulted in EM console corresponding to the rejected file case. The moment happens before an instance is created through BPEL/Mediator and after the JCA based File Adapter polls the file.
Here is a diagram which explains something about Fault Policy Framework
image : www.ateam-oracle.com
The fault policy framework works for File Adapter error scenarios if in place.
Here is a sample:
Below is an extract from Fault Binding xml file. A fault binding file is structured for composite, component, reference and service faults. Here, file adapter read is a service so I have added "RejectedMessages" as the fault policy to refer to. There are two composites which uses File/FTP adapter to read the files.
-ReadOrderFile
-ReadPaymentFile
<?xml version="1.0" encoding="UTF-8"?>
<faultPolicyBindings version="2.0.0"
xmlns="http://schemas.oracle.com/bpel/faultpolicy"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<composite faultPolicy="ErrorFaultPolicy"/>
<component faultPolicy="ErrorFaultPolicy"/>
<reference faultPolicy="ErrorFaultPolicy"/>
<service faultPolicy="RejectedMessages">
<name>ReadOrderFile</name>
<name>ReadPaymentFile</name>
</service>
</faultPolicyBindings>
Forany service related error, we can configure the Fault Policy framework to handle it.
Let us see the Fault policy file.
<faultPolicy version="2.0.0" id="RejectedMessages">
<Conditions>
<faultName xmlns:rjm="http://schemas.oracle.com/sca/rejectedmessages"
name="rjm:ReadOrderFile">
<condition>
<action ref="ReadOrderFile_001"/>
</condition>
</faultName>
<faultName xmlns:rjm="http://schemas.oracle.com/sca/rejectedmessages"
name="rjm:ReadPaymentFile">
<condition>
<action ref="ReadOrderFile_002"/>
</condition>
</faultName>
...
...
...
<Actions>
<Action id="ReadOrderFile_001">
<fileAction>
<location>/../../../error</location>
<fileName>Order_Error_%ID%_%TIMESTAMP%.dat</fileName>
</fileAction>
</Action>
<Action id="ReadOrderFile_002">
<fileAction>
<location>/../../../error</location>
<fileName>Payment_Error_%ID%_%TIMESTAMP%.dat</fileName>
</fileAction>
</Action>
...
...
So you can see here, that rejected files will be thrown to the given sample location with a generated ID and TIMESTAMP. The location and fileName tags defines those details about the File Action.
The actions are choice. We can either call a java service, a bpel composite , retry , rethrow etc for the way we want to handle the fault.
The best practice is to push the rejected files into a particular location shared to the application response for generating file data. Further, any manual/automated activity can be executed to decide actions taken on those corrupted files.
Thanks.
In this post, let us see how to handle rejected files.
File Adapters/ FTP Adapters which are used in scenarios where files are polled in SOA Suite, there are cases where corrupt or bad files can come or be present.
By default, File Adapter uses a default location to put rejected files as per the control directory which is configured in the Adapter configuration in weblogic. The instance is faulted in EM console corresponding to the rejected file case. The moment happens before an instance is created through BPEL/Mediator and after the JCA based File Adapter polls the file.
Here is a diagram which explains something about Fault Policy Framework
image : www.ateam-oracle.com
The fault policy framework works for File Adapter error scenarios if in place.
Here is a sample:
Below is an extract from Fault Binding xml file. A fault binding file is structured for composite, component, reference and service faults. Here, file adapter read is a service so I have added "RejectedMessages" as the fault policy to refer to. There are two composites which uses File/FTP adapter to read the files.
-ReadOrderFile
-ReadPaymentFile
<?xml version="1.0" encoding="UTF-8"?>
<faultPolicyBindings version="2.0.0"
xmlns="http://schemas.oracle.com/bpel/faultpolicy"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<composite faultPolicy="ErrorFaultPolicy"/>
<component faultPolicy="ErrorFaultPolicy"/>
<reference faultPolicy="ErrorFaultPolicy"/>
<service faultPolicy="RejectedMessages">
<name>ReadOrderFile</name>
<name>ReadPaymentFile</name>
</service>
</faultPolicyBindings>
Forany service related error, we can configure the Fault Policy framework to handle it.
Let us see the Fault policy file.
<faultPolicy version="2.0.0" id="RejectedMessages">
<Conditions>
<faultName xmlns:rjm="http://schemas.oracle.com/sca/rejectedmessages"
name="rjm:ReadOrderFile">
<condition>
<action ref="ReadOrderFile_001"/>
</condition>
</faultName>
<faultName xmlns:rjm="http://schemas.oracle.com/sca/rejectedmessages"
name="rjm:ReadPaymentFile">
<condition>
<action ref="ReadOrderFile_002"/>
</condition>
</faultName>
...
...
...
<Actions>
<Action id="ReadOrderFile_001">
<fileAction>
<location>/../../../error</location>
<fileName>Order_Error_%ID%_%TIMESTAMP%.dat</fileName>
</fileAction>
</Action>
<Action id="ReadOrderFile_002">
<fileAction>
<location>/../../../error</location>
<fileName>Payment_Error_%ID%_%TIMESTAMP%.dat</fileName>
</fileAction>
</Action>
...
...
So you can see here, that rejected files will be thrown to the given sample location with a generated ID and TIMESTAMP. The location and fileName tags defines those details about the File Action.
The actions are choice. We can either call a java service, a bpel composite , retry , rethrow etc for the way we want to handle the fault.
The best practice is to push the rejected files into a particular location shared to the application response for generating file data. Further, any manual/automated activity can be executed to decide actions taken on those corrupted files.
Thanks.