iris-ftp-sample
This is a sample how to use FTP Adapter (Inbound and Outbound).
What The Sample Does
This sample has an interoperability production for:
- Receive CSV data using FTP Inbound Adapter into a LoadCSVFTPBusinessService Business Service and send its content to a LoadCSVFTPBusinessOperation Business Operation to persist the content in a Persistent class using csvgen.
- Do CDC (Change Data Capture) on Payment table using SQL Inbound Adapter into a PaymentSQLBusinessService Business Operation and send table data (inside a JSON file) to a SendSQLDataToFTPBusinessOperation Business Operation for put the json file into FTP server.
Here you can see this production:
Prerequisites
Make sure you have git and Docker desktop installed.
Installation: ZPM
Open IRIS Namespace with Interoperability Enabled.
Open Terminal and call:
USER>zpm “install iris-ftp-sample”
Installation: Docker
Clone/git pull the repo into any local directory
$ git clone https://github.com/yurimarx/iris-ftp-sample.git
Open the terminal in this directory and run:
$ docker-compose build
- Run the IRIS container with your project:
$ docker-compose up -d
How to Run the Sample
- Create the credentials to access the FTP server (Go to Interoperability > Configure > Credentials):
-
ID: FTPCredentials
-
User Name: irisuser
-
Password: sys
-
Here is likes look it:
- Open the production and start it. It is the production:
- Open a FTP client (I’m using Filezilla) and put the input/countries.csv file into the root FTP folder:
- Host: localhost
- User name: irisuser
- Password: sys
- Image showing how to put the file on FTP server root folder:
- Go to the System Explorer > SQL and type
SELECT country, latitude, longitude, name FROM dc_irisftpsample.Country
. See here likes look the csv data loaded into the sql table:
- Go to the System Explorer > SQL and type
insert into dc_irisftpsample.Payment(amount payer, receiver, transactiondate) values(100.0,'Yuri','Fabiana', CURRENT_TIMESTAMP)
. See here likes look the JSON file into the FTP server with the data inserted:
How to work with this sample
This repository is ready to code in VSCode with the ObjectScript plugin.
Install VSCode, Docker and ObjectScript plugin and open the folder in VSCode.
Use the handy VSCode menu to access the production and business rule editor and run a terminal: