Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Haresh
Contributor
Contributor

how to connect to multiple ftp sites based on the ftphost name using one talend job

0693p00000AH3YlAAL.pngI am trying to connect to multiple ftp sites ,the thing is only the ftp host name (ip address) varies between different ftp sites and the username,password,port ,directory are all the same where i would to download and read /retrieve the latest files.

I have an existing flow,where it connects to one particular ftp site and does the operation,now i want to add multiple ftp sites using the context variable and invoke multiple flows for different ftp sites as part of the same flow considering only the HOSTNAME will vary,everything else is exactly the same.

Should i use a trunjob component or which is the easiest way to handle this?

Can someone show how the real time job flow would look like,right now i am using only one ftp connection,ftpfielist,ftpget,ftpclose for one sequential connection,i wonder how to make sure several flows varying based on ftphost name and embed them into one single talend job flow?

7 Replies
manodwhb
Champion II
Champion II

@Haresh Sivakumar​ ,since hostname is changing right lets keep the hostname in a table or file and read that table or a file and iterate using tFlowtoIterate and connect to tFTPXXX components to do your next work.

 

Thanks,

Manohar

Haresh
Contributor
Contributor
Author

@Manohar B​ thanks for the solution,i have the upper half of my job flow that looks like this and all the ftp credentials are installed as part of the context variables ,so how do i embed the hostname in a file and read from that ->tflowtoiterate such that it wont disrupt my existing job sequence.I have attached the image for your reference,please take a look and suggest!

Haresh
Contributor
Contributor
Author

@manodwhb (Customer)​ thanks for the solution,i have the upper half of my job flow that looks like this and all the ftp credentials are installed as part of the context variables ,so how do i embed the hostname in a file and read from that ->tflowtoiterate such that it wont disrupt my existing job sequence.I have attached the image for your reference,please take a look and suggest!

manodwhb
Champion II
Champion II

@Haresh Sivakumar​ ,After tjava_1 use the tDBInput or tFileInputDelimitted and connect to tFlowtoIterate and connect Itretate flow to tFTPConnection.

 

 

Thanks,

Manohar

Haresh
Contributor
Contributor
Author

0693p00000AH3c9AAD.pngi added that accordingly however,i am getting errors -so here is what i did created an excel file with the list of hostname in column A of the excel file.

 

Step 2:tjava---iterate--->tfileinputdelimited---row3main--->tflowtoiterate(default key,value) pair----iterate---->tftpconnection0693p00000AH3cEAAT.png 

 

step 3 :tftpconnection i am using host:row3.ftphost instead of context variable since row3 schema has ftpfhost as one of the column name (string).

 

 

i also noticed that in tftpget and tftpclose -since i am using existing connection as :TFTPCONNECTION1-FTP i would need to change the settings for both the components accordingly as well.

 

Let me know what i am missing here to make it work properly

manodwhb
Champion II
Champion II

@Haresh Sivakumar​ ,changes the host name in tFTPConnection and use as below way.

((String)globalMap.get("row3.ftphost"))

 

 

Thanks,

Manohar

Haresh
Contributor
Contributor
Author

Not sure what is breaking the flow:0693p00000AHDqpAAH.png 

even after using the host name as :((String)globalMap.get("row3.ftphost")) it wont retrieve anything

 

[FATAL]: dataintegration.att_dmx_10_0_1.ATT_DMX_10 - tFTPConnection_1 java.net.UnknownHostException: PK

 

when i tried to print the value using system.out.println it shows nothing for row3.ftphost