close a TFTPConnection

Highlighted
One Star

close a TFTPConnection

I have a DI job with the following flow:
tFTPConnection -> tFTPFileList -> tFTPGET -> tJava -> tFTPRename
I check the "Use an existing connection" checkbox for the subsequent tFTP components.
Everything works fine but, once we scheduled this job, it caused issues with the SFTP server we are connecting to since the connections were never closed. We wound up with multiple attempted connections.
I searched on this issue and found some forum posts from a few years ago. But I'm wondering if there's updated information on this topic. What's the best way for me to close the SFTP connection at the end of the job?
Seventeen Stars

Re: close a TFTPConnection

Actually this would be a good reason to build a component!
Add a tJava component to your job where you want to close the connection and add this code:
You have to apply your tFTPConnection number for the global map key.
This code works only for the SFTP connection.
com.jcraft.jsch.ChannelSftp c_tFTPConnection_1 = (com.jcraft.jsch.ChannelSftp) globalMap.get("conn_tFTPConnection_1");
c_tFTPConnection_1.disconnect();

In case of simple FTP use this code:
com.enterprisedt.net.ftp.FTPClient ftp_tFTPConnection_1 = (com.enterprisedt.net.ftp.FTPClient) globalMap.get("conn_tFTPConnection_1");
ftp_tFTPConnection_1.executeCommand("exit");
Seventeen Stars

Re: close a TFTPConnection

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog