Powered By Blogger

Tuesday, November 5, 2013

File naming convention sequencing strategy for FILE/Ftp Adapter

As we know, File/Ftp adapter allows us to configure sequence as part of file naming convention when we generate files.For example, if you choose PO-data_%SEQ%.xml as the FileNamingConvention, all files would be generated as PO-data_1.xml, PO-data_2.xml,..
JCA file would have property like

<property name="FileNamingConvention" value="PO-data_%SEQ%.xml"/>

As per Oracle, sequence is maintained as mentioned below 
The sequence number is being maintained in the control directory of  corresponding composite project. For each project that use the File or Ftp Adapter, a unique directory is created for book-keeping purposes. Because this control directory must be unique, the adapter uses a digest to ensure that no two control directories are the same.
The control information for project would go under FMW_HOME/user_projects/domains/soainfra/fileftp/controlFiles/[DIGEST]/outbound where the value of DIGEST would differ from one project to another.
Within this directory, there is a file control_ob.properties file where the sequence number is maintained. The sequence number is maintained in binary form and you might need a hexadecimal editor to view its content. There is another zero byte file, SEQ_nnn. This extra file is maintained as a backup.

One of the challenges faced by the adapter run time is to guard all writes to the control files so no two threads inadvertently attempt to update the control files at the same time. It does this guarding with the help of a "Mutex". The mutex is of different types:
  • In-memory
  • DB-based
  • Coherence-based
  • User-defined
There might be scenarios, particularly when the Adapter is under heavy transactional load, where the mutex is a bottleneck. The Adapter, however, enables you to change the configuration so the adapter sequence value is derived from a database sequence or a stored procedure. In such a situation, the mutex is by-passed, and the process results in improved throughput.
The simplest way to achieve improved throughput is by switching your JNDI connection factory location for the outbound JCA file to use the eis/HAFileAdapter:
eis/HAFileAdapter is available by default when we install SOA
Above connection factory can also be used to support high availability in SOA cluster in active-active mode

Check control directory is setup for specific path to keep house keeping information 


Check how HAFile or HAFtp Adapter is configured with SOA data sources to maintain sequence in soainfra database schema


With this change, the Adapter run time creates a sequence on the Oracle database(SOA dehydration store). For example, if you do a select * from user_sequences in your soa-infra schema, you see a new sequence being created with name as SEQ___ (where the GUID differs by project).
However, to use your own sequence, you must add a new property to your JCA file called SequenceName. You must create this sequence on your soainfra schema beforehand

<property name="SequenceName" value="Adapter_Seq"/>

No comments:

Post a Comment