Thursday 9 January 2014

1Q) What is the behaviour of Inbound File Adapter when it is deployed in single-node environment and cluster node environment.
Ans) For Inbound File Adapter in single-node, it picks(reads) the file and single instance is created for each file read.
Where as it is quite opposite, in cluster environment both nodes of the cluster processes the same file, causing duplicate records in final system

Resolution: this issue could be resolved by two ways:

1)Use Singleton property for the inbound endpoint for SOA composite. 
In the clustered environment when the processing of the message should happen via only one SOA managed server, then the property singleton needs to be defined at the adapter level.
To enable this just add singletom property to composite.xml.


<service name="CustomerInfo" ui:wsdlLocation="CustomerInfo.wsdl">
<interface.wsdl interface="http://xmlns.oracle.com/ht/soa/jcaadapter/fileadapter/customerinfo#wsdl.interface(Read_ptt)"/

<binding.jca config="CustomerInfo_file.jca">
         <property name="singleton">true</property>
</binding.jca>

</service>

2)To use HAFileAdapter for File Adapter.     In the .jca file of Inbound File Adapter change location attribute value from eis/FileAdapter to eis/HAFileAdapter.

<adapter-config name="CustomerInfo" adapter="File Adapter" wsdlLocation="CustomerInfo.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
  <connection-factory UIexcludeWildcard="*.tif;*.lock" location="eis/HAFileAdapter"       

    UIincludeWildcard="*.*"/>
   <endpoint-activation portType="Read_ptt" operation="Read">
     <activation-spec className="oracle.tip.adapter.file.inbound.FileActivationSpec">
       <property name="DeleteFile" value="false"/>
       <property name="MinimumAge" value="0"/>
       <property name="PhysicalDirectory" value="/u01/shared/einvoice"/>
       <property name="Recursive" value="true"/>
       <property name="PollingFrequency" value="10"/>
       <property name="IncludeFiles" value=".*\..*"/>
       <property name="UseHeaders" value="false"/>
       <property name="ExcludeFiles" value=".*\.tif;.*\.lock"/>
     </activation-spec>
   </endpoint-activation>
 </adapter-config> 


Behind HAFileAdapter is the database used as mutex to ensure the one file is only handled by one instance. By default it uses jdbc/SOADataSource.When using HAFileAdapter in OSB this jdbc/SOADataSource should also target the OSB server nodes as well.

This also invovles some configuration changes for File Adapter. 
You need to set Deployments->File Adapter->Configuration->Outbound Connection
Pools->javax.resource.cci.ConnectionFactory->eisHAFileAdapter->controlDir to some shared localtion.

To my understanding the first way is to force to seralize the inbound file processing,
which means only one File Adapter is processing a file at one time.  
HAFileAdapter is using some mutex to ensure one file is only processed by one FileAdapter instance.  


But the multiple HAFileAdapter can process the different file at the same time. 
So this is the real solution for high availability environment.

1 comments: