Thursday, June 20, 2013

FTP/FILE Adapter

Set the File adapter to process files based on their creation date/time:-

First of all you need to apply patch 6445656 -ALLOW FILE PROCESSING BY CREATION DATE

Now in the WSDL of the file adapter set the following

ActivationSpec="oracle.tip.adapter.file.inbound.FileActivationSpec"
Sorter="oracle.tip.adapter.file.sorter.TimestampSorterAscending"

to sort the files in ascending order

or

ActivationSpec="oracle.tip.adapter.file.inbound.FileActivationSpec"
Sorter="oracle.tip.adapter.file.sorter.TimestampSorterDescending

to sort the files in descending orders.

You also need to model your bpel process.
Make the BPel process a synchronous process and

Set Number of threads in bpel/system/services/config/pc.properties to "1"

This setting will allow the files to be sorted as per their date/time stamp.

This feature has been added as a feature in 10.1.3.3 MLR#14 onwards

If you want to use the same feature in FTP adapter you need to do some extra settings.

In the inbound activation you need to set useNlst="true"

This parameter tells the adapter to use LIST command to get filenames in a list. Thus the adapter can capture the tiemstamp, size information during the inbound listing.


So your entry should look like this

ActivationSpec="oracle.tip.adapter.ftp.inbound.FTPActivationSpec"
DeleteFile="true"
IncludeFiles=".*\.txt"
PollingFrequency="60"
MinimumAge="0"
useNlst="true"
Sorter="oracle.tip.adapter.file.inbound.listing.TimestampSorterAscending"

Here again you need to Edit file SOA_HOME\bpel\system\services\config\pc.properties and change
oracle.tip.adapter.file.numProcessorThreads=1

If you are using ESB you need to edit file SOA_HOME\integration\esb\config\pc.properties.

If you don't have this property file you can just reanme the pc.properties.esb to pc.properties and make the changes there

====================================================================================

Controlling the name of the Archieved file in FTP adapter :-

The FTP adapter by defalut add the timestamp to the file created so that if the ftp adapter is creating a file of same name it can be distinguished easily from the previous file.

You need to model your bpel process,Make it as a synchronous bpel process

Use synchronous read feature to read the file and then move it to the archive folder

use the header mechanism to use the same file name

In order for a FTP adapter to move file to remote archive directory, specify
UseRemoteArchive="true" in the adapter wsdl (as an attribute of the jca:operation)

Deploy your process.
====================================================

The date format for the XML element that has to be used with file adapter should be in the following format YYYY-MM-DDTHH:mm:ss

========================================================

Obtain the size of files

In the file|FTPAdapterInboundHeader.wsdl make an entry for size

<element name="InboundFileHeaderType">
<complexType>
<sequence>
<element name="Name of FIle" type="string"/>
<element name="Directory of file" type="string"/>
<element name="Size of file" type="string"/>
</sequence>
</complexType>
</element>


Now Create a variable to read the size element published from the inbound and assign it to some output variable to display the result.

=============================================

configure number of threads for file/ftp adapter

FOR bpel SOA_HOME\bpel\system\service\config. Set the value for oracle.tip.adapter.file.numProcessorThreads in pc.properties file. By default, it is set to 4.
For esb rename SOA_HOME\integration\esb\config\pc.properties.esb to pc.properties. Set the value for oracle.tip.adapter.file.numProcessorThreads.

No comments: