Tuesday, February 21, 2012

JCA File Adapter process the same file twice in a clustered envrionment causing duplicate records

I use JCA File Adapter in a clustered environment, both nodes of the cluster processes the same file, causing duplicate records in final system. The simple answer is to use "HAFileAdapter" instead of "FileAdapter". In your .jca file:

<adapter-config name="JcaFileCopy" adapter="File Adapter"

<connection-factory location="eis/HAFileAdapter"...

HAFileAdapter uses database behind the scene to create mutex to make sure only one node will process one file.

Ideally, that's all you need to do. However, I use this JCA file adapter inside my OSB. Simply changing to "HAFileAdatper" is not good enough. By default, HAFileAdapter uses SOADataSource for the behind scene locking mechanism. By default SOADataSource deployment target contains SOA server only ("soa_server1" in my case or whatever your SOA server name happens to be), so you need to re-configure SOADataSource, add your OSB server (osb_server1) to the deployment target list of  the data source. Otherwise, you may scratch your head forever.

Friday, February 17, 2012

SOA deployment plan with JCA properties

Configuration/Deployment plan has a section for JCA, somehow i can't get this to work (
 <reference name="JcaCopyFile">
      <!-- ################### can't get this section to work, so add <wsdlAndSchema name="JcaCopyFile_file.jca"> at the bottom
         <binding type="jca">
          <property name="TargetPhysicalDirectory">
          <property name="TargetDirectory">
it works with this:

  <wsdlAndSchema name="JcaCopyFile_file.jca" xmlns:jca="http://platform.integration.oracle/blocks/adapter/fw/metadata">
    <jca:property name="TargetPhysicalDirectory">