Oracle SOA Suite FTP Adapter is used to exchange file data - it can be a read or write a file to remote server file systems. The adapter built using the well known JCA architecture to transfer files in an heterogeneous Enterprise Information Systems (EIS).
In this post, lets look at the way to read large files opaquely using the FTP Adapter. By Opaque, I meant where the file data read as such doesn't matter and the objective is to just process the file contents read by the FTP Adapter as it is.
The ideal way to get this done is using the option Read File as Attachment which is available only when you check the inbound Get operation while configuring the FTP adapter in the composite.
Let's take this up with a use case - a composite designed to read large pdf file from the FTP server and place the same file as-is on the local server where the SOA server is running. I shall highlight only the important steps of design of this composite with JDeveloper IDE screen snapshot.
FTP Adapter used to Get File from the remote server
Step showing the FTP Adapter Configuration Wizard with Get File as operation type selected and Read File As Attachment option checked.
FTP Configuration Wizard with file pattern to be polled mentioned with file wildcard as *.pdf
File Adapter to write the same file to the local file system where the service is running
Step showing the file path where the file will be written and the file name pattern.
File Configuration wizard to select the attachment element reference, that way the data type is same as that of the FTP Get variable.
The composite file in design mode after creating the FTP and File Adapters is as below:
Add a BPEL service component to your composite, edit it to add a receive, assign and invoke activity and wire those activities/partnerlinks appropriately as shown below:
Edit the Assign activity to map the receive GET variable value with the invoke activity write variable:
Note that in the assign activity of the BPEL component the reference value is assigned and not the actual file content. The file content are stored in the ATTACHMENT table of the SOA Infra schema as BLOB data type in Attachment column against this reference value (column name is Key). The SCA engine will take care of fetching the file content from the ATTACHMENT table at run time before the invoke activity is executed to write the file content onto the local file system.
The above method to read a file using FTP adapter is very efficient especially if there are large files to be read from the FTP server and the content of the file does not matter. You can even combine this with encryption or compression logic in your composite before the file is passed to the target location or for further processing.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.