One Star

Integrate TalenJob in route

hi
I have a job :
- tFileInputDelimited -> tMap -> TAdvancedFileOutputXml just for a transformation
I export this jar file and reimport it as a TalendJob in a route
In this route I would like to files arriving in a cFile and tFileInputDelimited that I have in my job.
So from a cFile, launch a route.
how could I do it?
thks
Valery

  • ESB
14 REPLIES
One Star

Re: Integrate TalenJob in route

Can Someone help me?
thks
valery
One Star

Re: Integrate TalenJob in route

Hi,
I don't want to dissapoint you, but seems even the TOS supports to add the tJob icon to the route model, it doesn't work - neigther for me. In some docummentation or one of forum contributions I found that this feature still needs to be developed (I use TOS 5.0.2).
As a solution - we exposed our jobs as services or mroe often - let them listen on their queues, and then from mediation route (Camel) or eny external application we send a message to the job queue for processing or call the job's web service.
so - in the route send the file content or the file name - cFile-->cMessageEndpoint and than have a job tMomInput->process the message
Couldn't find anything better Smiley Sad
Gabriel
Employee

Re: Integrate TalenJob in route

hi valery,
here's what you need to pass the filename from the Camel route to the job:
1) in the job you need a context variable, e.g. filename - I assume you have that already
2) create a Camel route like the one attached

3) cTalendJob passes all Camel headers to the job, so you need to set a header that has the same name as the context variable in your job, e.g. filename - see the next screenshot for how to configure a cSetHeader

4) if the job you want to start from the route requires additional JARs that are not yet on the classpath, you need an additional cConfig to add the external dependencies. I needed talend_file_enhanced_20070724.jar for a tFileInputPositional.


let me know if this is what you needed and works for you?
hth
bernhard
One Star

Re: Integrate TalenJob in route

Hi,
that is a great help even for me, thanks Smiley Happy
Gabriel
One Star

Re: Integrate TalenJob in route

Hi guy's
it's so simple when you speak with person who knows the product.
@bschuhmann,
As I can see you work for Talend. So I have some question for you.
- Why those type of basic actions are not documented somewhere? effectively integrate a route with a job is the added value of the product. Why is it so difficult to find doc about it?
The product is it mature enough?
- by reading doc, I found that we have to use config object to define librairies. Why do we have to do it? effectively when I am importing the Jar job file, all those required librairies are already it the Web-inf/lib directory?
Thks for your help. Now it's more clear
Valery
One Star

Re: Integrate TalenJob in route

Hello all.
Many many thanks for the short description of how to pass arguments from a route to a job.
This was the piece of glue I was looking for the last few month.
Regards,
Alexander.
Employee

Re: Integrate TalenJob in route

Hi Valery,
- Why those type of basic actions are not documented somewhere? effectively integrate a route with a job is the added value of the product. Why is it so difficult to find doc about it?

We're writing doc, just need to ask for a bit more patience Smiley Wink
The product is it mature enough?

It is. Test it and I'm confident it will work for you.
- by reading doc, I found that we have to use config object to define librairies. Why do we have to do it? effectively when I am importing the Jar job file, all those required librairies are already it the Web-inf/lib directory?

Give 5.1 RC1 a try, I know we're working on it and it might already be fixed. Dependency resolution is not trivial (especially with the different runtime environments) and we though even with this snag, cTalendJob is already useful.
One Star

Re: Integrate TalenJob in route

Hi,
another related question - maybe it is simple and I am not aware of it..
is there a simple way to get data back from the integrated "in-route" job?
In theory - I can create a web service from a job and invoke the job as a service. But if there's a simple way to synchronously call the job, maybe there's a way to get data back (something like using tBufferOutput) like between Talend jobs..
Thankx in advance
Gabriel
Employee

Re: Integrate TalenJob in route

One way is to use a tSocket connector on the job side and a camel-mina component on the other side. Alternatively you could use JMS with tMOM on the job side and the cJMS on the route side. I'll post a link to an example later.
One Star

Re: Integrate TalenJob in route

Hi Edward,
that's an answer too. If there's no direct approach, JMS is a very good way to return data.
Thanks for the prompt reaction.
Carpe diem
Gabriel
Employee

Re: Integrate TalenJob in route

You can find a sample job and a corresponding route on my site at http://eost.net/eost/jobAdaptor/socketPipeJob.zip .
Note that in order to use the Camel MINA component you need to use the cConfig element to add the dependency.

Note that the Camel route shown below uses a glorified sticky note just to represent the Job. It's just for show. The real elements doing the work implemented with tMessageEndpoint and the appropriate Camel Mina uri. you can find more information on how to specify that uri in the Talend Integration Factory User's Guide, or online at http://camel.apache.org/mina.html

Note that the DI Job uses tSocket as documented in the Talend Component Reference Guide which you can download from our site. When you run this in Studio, start the Camel client first. It will keep trying to (recoonnect) until you start the Job. Note that by default the DI job will end after processing one request unless you put it in a loop. In contrast, if you did the same thing with tMOM for your job you could specify "Keep Listening" in the component view.
One Star

Re: Integrate TalenJob in route

Hi Ed,
I've never been fond of socket communication, but you are right, Mina looks effective for this use case.
Thankx a lot.
Gabriel
One Star

Re: Integrate TalenJob in route

bschuhmann,

Can you please share screen shots as I didn't see that.
One Star

Re: Integrate TalenJob in route

Its better to use a Camel component dependency instead of direct camel-*-alldep usage: