In Some of the scenarios of FTP File transfer in a typical BPEL Process, we might need to set the location of Archive Directory dynamically, either by picking from some configuration properties file or from the payload at runtime. To achieve this we need to follow the below mentioned steps:
- In FTP WSDL file set the jca properties to select logical directories for Archive or source file location directory.Also Set the property "UseRemoteArchive" to true.
<jca:operation FileType="binary"
LogicalDirectory="directory"
InteractionSpec="oracle.tip.adapter.ftp.outbound.FTPReadInteractionSpec"
LogicalArchiveDirectory="FileArchiveDirectory"
DeleteFile="true"
FileName="fileName"
OpaqueSchema="true"
UseRemoteArchive="true" > - In the BPEL service flow, when we invoke the FTP adapter to either get/put files, we can see that bpel.xml file gets update with the partner link binding details. In the partner link binding details keep the values blank for LogicalArchiveDirectory. <property name="FileArchiveDirectory" type="LogicalArchiveDirectory"></property>.
- However we can set the outbound directory location by using ftpAdapterOutboundHeader. We cannot do the same for the Archive Directory. Hence we will use the following function in the JavaEmbedding to set the ArchiveDirectory. Location.getLocator().lookupProcess("<<ProcessName>>").getDescriptor().getPartnerLinkBindings().getPartnerLinkBinding("<<PartnerLinkBindingName>>").setPropertyValue("FileArchiveDirectory",(String)getVariableData("archiveDir"));
}
catch(Throwable ex){
addAuditTrailEntry("Exception - " + ex.getMessage());
} This way we can set the Archive Directory Location in the bpel.xml file dynamically where getVariableData("archiveDir") is the archive directory location variable set in the bpel flow.
Where are you defining/setting the value of the archiveDir variable? Not sure where it is getting the value from when you do the getVariableData("archiveDir"));
ReplyDeleteFor using getVariableData("archiveDir")) in the Java embedding activity, in the BPEL flow you first need to create a variable and assign the vale for archiveDir. This you can assign dynamically by declaring the same in some properties file. I hope this helps.
DeleteI am getting: the exception reported is: java.lang.RuntimeException: failed to compile execlets of
ReplyDeletewhich import I need for Location.getLocator() to work?
This comment has been removed by the author.
ReplyDeleteI am getting instantiation exception while building the same. I am following your approach to achieve the same using File Adapter in SOA 11g
ReplyDeletePlease help
Hi Vyshali
ReplyDeleteThanks for the post. Can you send me the composite you have used the dynamic archiving in FTP. It would help me greatly.
nitinthenolaguy@gmail.com
Thanks
Kumar