Version: 17.07
Supported Since: 17.01
The SFTP Egress Connector can be used to send messages to a remote SFTP server and same as the inject connectors, UltraESB framework can communicate with almost all the SFTP servers which implements the generic SFTP protocol.
When you are sending a message to a SFTP server, UltraESB server expects the file content as the message payload and file name as a variable.
In order to use the SFTP Egress Connector, you must first select the SFTP Connector dependency from the connector list when you are creating an empty Ultra project. If you have already created a project, you can add the SFTP Connector dependency via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Connectors list, select the SFTP Connector dependency. |
On Exception |
The message will be emitted from this out port if the processing element failed to upload the given file to the configured SFTP location |
Connector Operation |
This port is used to connect operational elements to the Egress Connector. By-default, user does not have to connect any operational element and the default connector operation will be used. |
* marked fields are mandatory
Host Name * |
Basic |
Host name/IP of the SFTP server that you are going to send files |
Port * |
Basic |
Port of the SFTP server that you are going to send the files. By default value of this will be set to 22 |
File Path * |
Basic |
Path of the SFTP server that you are going to send files. This path should be relative to the home directory of the above given user |
File Name |
Basic |
File name for the payload to be saved (if there is an original name to the file, it will be preserved if this property
is not provided). In-order to construct the file name, you can use message headers, message properties, additional
variables set, message ID, message context ID, and message context properties in following formats respectively.
Further, if the file name is not set and the message contains a transport header with key |
Append Mode |
Basic |
If this is enabled, the framework will append the current message payload if there is a file with same name in the given location. If this is disabled, existing file will be replaced by the new file at the SFTP server sending path |
Username |
Basic |
Username that you are going to use to connect to the SFTP server |
Password |
Basic |
Password for above user name if you are going to connect via password based authentication to the SFTP server |
Key File Path |
Key Authentication |
Path of the private key of the user which will be used to communicate with SFTP server via key based authentication. |
Key Password |
Key Authentication |
Password of the private key if it is password protected. |
Host Key Check |
Key Authentication |
Set to enable the host key checking while creating the communication channel with SFTP server. If this is not enabled, host key checking will be skipped while SFTP processing. By default, this will be false. |
Weight |
Advanced |
Weight for the Egress Connector if this Egress Connector is with a weighted Egress Load Balancer |
Max Connections |
Advanced |
Maximum number of connections which will be cached within the SFTP EgressConnector for the configured SFTP server. By default, this value is 10. |
Timeout |
Advanced |
Timeout in millis, to be used while connecting to the remote SFTP server. If it couldn’t establish a connection with the SFTP server within this time period, it will be considered as a connection failure and notify to the user. By default, this value is 60000. |
In this use case scenario, requirement is to poll the files from a local directory and send all the JSON files in the local directory to a SFTP server. For statistics and monitoring purposes it’s required to extract out the client ID’s from the input file and create a log specifying the extracted client ID value and sending file name name should be prefixed by the extracted client ID value.
To implement above use case, first let’s create our integration flow named “integrate-to-send-via-sftp” and first add the File Listener IngressConnector and configure input file receiving path and file name patterns to fetch input JSON files from the local directory.
Next processing element should be the JSON Path Extractor to extract out the Client ID from the received JSON message. JSON path of the client id should be configured as the JSON path parameter of this processing element. This processing element will extract out the parameter from the JSON message and save it as a variable with the name given in it’s Variable Name parameter.
After that, Logger processing element should be added to log the input file name and the respective client ID based on the value stored in the variable by the JSON path extractor.
Finally SFTP EgressConnector element should be added to the integration flow to send the file to the SFTP server as per the requirement use case. SFTP EgressConnector can be configured by filling the Basic properties as below,
After filling out the required parameters, this configuration can be saved by clicking the Save button at the bottom of each element.
With all above elements, complete integration flow would be like this,
File Name parameter is configured with @{message.var.CLIENT_ID}_@{message.header.ultra.file.name}
to modify the file
name by attaching the client ID as the suffix for the original file name. Framework will replaced the @{message.var.CLIENT_ID}
from the value of the variable with name CLIENT_ID and @{message.header.ultra.file.name}
will be replaced by the value
of the transport header with name ultra.file.name
which is the original file name received via File IngressConnector.
Now if you run the flow, and put an JSON file to with name ends with _Adroitlogic.json, to the configured local folder that file should be send to the configured SFTP server and file name should be prefixed with the Client ID of the input message