We usually do file polling from local or remote system using File and FTP adapter. We poll either XML or flat files, File and FTP adapter generate XSD (Schema) for flat file and use already existing schema for XML file. If the file comes in required format or structure then adapter will pick the file and read its content as expected but what happen when file didn’t come in expected format.
As you notice when we poll the file and file is corrupt i.e. not in correct format then we don’t see any instance in em console and file got deleted so we never come to know that what went wrong with file as there is no instance on em console.
Solution to above problem is error handling. We have two types of error handling for file and ftp adapter.
- In-Build error handling
- Custom error handling using Fault Handling Framework
By default adapter has in-build error handling that will put the message to rejected folder if file which it try to read is corrupt i.e. not in correct format.
In this post, I will show you how in-build error handling works for file and ftp adapter.
I have created one sample composite which poll the file from local system so we are using file adapter to poll that file. File that we are going to use here is XML.
Below is the configuration for file adapter.
When the file is correct then we see file got deleted from the folder and new instance in em console.
But when the file is not in correct format then we see that file got deleted from folder but no instance created on em console.
In above case adapter will move that corrupted file to rejected messages folder.
Rejected Messages folder path: C:\Oracle\Middleware\user_projects\domains\base_domain\rejmsgs
Download sample code from here.
Next post explain about next error handler, File Rejection Handler - File error handler for File Adapter.