Monday, 3 December 2018

Poll File from Agent server leveraging File Adapter: Integration Cloud

Oracle Integration Cloud provides a File adapter to deal with the files which reside on the local server.

File adapter allows following operations on an on-premise location, using Integration Cloud connectivity agent:
  • File polling
  • Write 
The in and out directories should be locally accessible from the server where ICS connectivity agent is installed.

Refer the blog to understand the difference between File and FTP adapter

Use Case: For the particular article, we'll leverage the File adapter to poll the file from the server where connectivity agent is installed and transfer the file on FTP server.

Let's get started and see how to achieve the use case
  • Create an Orchestration process in Integration Cloud Service with name PollFile
  • Drop File connection as a trigger point
  • Enter below information and click the Next button
    • What do you want to call your endpoint? PollFileFromServer
    • Do you want to define a schema for this endpoint? No
  • Enter below information and click the Next button
Information
Description
Value
Specify an Input Directory
Enter the input directory for File reading
/home/PollDir
Specify a File Name Pattern
Specify the input file name pattern
*.*
Maximum Files
Specifies the number of files to be processed in a single poll operation
25
Polling Frequency
Specifies the polling operation frequency
60
Processing Delay
Specifies the polling operation frequency delay
5
Delete Files After Successful Reading
When selected, files are deleted after they are successfully read
Checked

  • Select Done button

  • Drop the FTP connection
  • Enter the endpoint name of your choice and click the Next button
  • Enter below information and click the Next button
    • Select Operation: Write File
    • Select a Transfer Mode: ASCII
    • Specify an Output Directory: /home/opc/tempfiles
    • Specify a File Name Pattern: *
    • Enable PGP security: No
  • Enter below information and click the Next button
    • Select the Do you want to define a schema for the endpoint radio button
    • Select the Select an existing schema from the file system radio button
  • Create a xsd file with below element and browse
<?xml version = '1.0' encoding = 'UTF-8'?>
<schema targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/opaque/" xmlns="http://www.w3.org/2001/XMLSchema">
    <element name="opaqueElement" type="base64Binary" />
</schema>

Note: An opaqueElement element is created of type base64Binary because while polling the file from the File server, it returns the element of base64Binary only.

  • Click the Done button
  • Edit the mapper and map below fields:
    • fileName -> fileName
    • element0 -> opaqueElement

  • Configuration is completed now. Close and Activate the integration
  • Keep three files on agent server at /home/PollDir directory
  • Open Integration Cloud monitoring dashboard and notice three instances should be created, one for each file

  • Open the FTP /home/opc/tempfiles directory and see three files should be there

No comments:

Post a Comment