One Star

[resolved] Route with FTP producer, followed by short delay, then FTP consumer?

I cannot, for the life of me, find a way to do the following in an ESB Route:

pick up files placed in directory (event driven -- runs when files appear)
put files on an FTP server
wait 5 seconds for the files to be processed
get response files from the same FTP server
I'm just looking for a hint as to how to accomplish this seemingly simple concept. Smiley Happy
I have tried cContentEnricher to consume from a Route Flow endpoint that is preceded by an FTP to get the response files but that FTP runs as soon as the Route starts and I want it to only run when I want it to. Smiley Wink
Thanks!
Mike.
1 ACCEPTED SOLUTION

Accepted Solutions
Fifteen Stars

Re: [resolved] Route with FTP producer, followed by short delay, then FTP consumer?

You are still essentially using a route, but have a DI job called as a component of that route. 
But, from what you have said, it sounds like simply decoupling the single route into two routes would work for you. Have one that PUTS the files to FTP server and one that GETS them. The GET one will only pull files when they are there and the PUT one will (I assume it is driven by the presence of local files) only PUT files when there are files to PUT. These two actions do not actually rely on each, they rely on the presence of files.
Rilhia Solutions
4 REPLIES
Fifteen Stars

Re: [resolved] Route with FTP producer, followed by short delay, then FTP consumer?

Why not use a cTalendJob to force this timing requirement you have. If you FTP inside a Talend Job and call it from the route, then when the message is sent from the FTP producer you can schedule a pause inside your Talend Job. 
Having said that, how can you be sure that 5 seconds will be sufficient? Would it not be better to have a name change carried out on the file and then use 2 routes. 
1) A route to send the file
2) Wait for whatever processes the file to finish. It will then rename it.
3) A route which is triggered by the renamed file being in place
This way you don't set an arbitrary timings (which will fail at some point) and you can decouple the input and  output process.
Rilhia Solutions
One Star

Re: [resolved] Route with FTP producer, followed by short delay, then FTP consumer?

@rhall_2.0:  It is even stranger than I described: The FTP server is a 3rd party company and when we PUT files to their server nothing happens until we do a GET of those same files, which triggers some processing on their end. The file we ultimately receive from the GET is a "response" to the processing of the file we'd PUT, not the original file. So, 5 seconds is actually not important.
That said I am not opposed to calling a DI Job to take care of this. I just hoped I could somehow do it in ESB without having to use DI. I fret over not being able to have a cFTP node as a Consumer in the middle of a Route. I wish there was a switch that I could use to force the node to be either a Consumer or Producer.
Mike.
Fifteen Stars

Re: [resolved] Route with FTP producer, followed by short delay, then FTP consumer?

You are still essentially using a route, but have a DI job called as a component of that route. 
But, from what you have said, it sounds like simply decoupling the single route into two routes would work for you. Have one that PUTS the files to FTP server and one that GETS them. The GET one will only pull files when they are there and the PUT one will (I assume it is driven by the presence of local files) only PUT files when there are files to PUT. These two actions do not actually rely on each, they rely on the presence of files.
Rilhia Solutions
One Star

Re: [resolved] Route with FTP producer, followed by short delay, then FTP consumer?

I have resolved this as suggested, by calling a DI route to get the response files from the FTP server. Smiley Happy