You are not logged in.

Unanswered posts



Important! This site has been replaced. All content here is read-only. Please visit our brand-new community at https://community.talend.com/. We look forward to hearing from you there!



#1 2008-05-20 23:08:07

lotu
Member
2 posts

lotu said:

Talend as part of another application

Hey I have been using talend a little and I want to use it as part of another Eclipse application.  Pretty much I want to take a job and call it from another java program.  I could use system to do this but, that is not very portable and I need my application to be portable.  Is there any good way to use a talend job inside another java program?

Offline

#2 2008-05-21 03:38:38

shong
Talend Team


shong said:

Re: Talend as part of another application

Hello lotu

Thanks for your interesting in Talend.
You can not only call a Java program in a Talend job, but also call a Talend job in a Java program. You can simply follow the steps below:
1) Create a simple job in TOS.(see screenshot1)
2) Export the job Java script.(see screenshot 2 and 3)

3) Unzip the Java script file on current folder.
4) Launch Eclipse and create a new Java project, then create a class 'Talend.java'.(see screenshot4)
5) Right click on test and select 'Build Path'-->'Configure Build Path'. (see screenshot 5)
6) Click on 'Add External Jars' button to import the jar file 'myjob_0_1.jar' (under myJob_0.1\myJob_0.1\myJob) and all the jar files (under myJob_0.1\myJob_0.1\lib) (see screenshot 6 and 7)

7) Type in the Java code in class 'Talend.java' (see screenshot 8)

public class Talend
{
	public static void main(String[] args)
	{

		shong.myjob_0_1.myJob.main(new String[]{});

	}
}

Here you will notice that:
shong: Talend project name
myjob_0_1: jar file name
myJob: Talend job name

8) Finally, run the Java program.(see the screenshot 9)

Best regards

         shong
mini_11713_1.pngmini_11713_2.pngmini_11713_3.pngmini_11713_4.pngmini_11713_5.pngmini_11713_6.pngmini_11713_7.pngmini_11713_8.pngmini_11713_9.png


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the global leader of open source data management and application integration solutions!

Offline

#3 2008-10-21 13:37:39

suzchr
Member
149 posts

suzchr said:

Re: Talend as part of another application

Hi everybody !
I'm very interisting by this solution but I'm interisting by two other things.
The first is I would like give argument for the context param
And the second my job finish by a tBuffertOutput component and I would like to recup the data.
How can I do ?
Thank you !

Offline

#4 2008-10-21 20:23:04

Volker Brehm
Member
1139 posts

Volker Brehm said:

Re: Talend as part of another application

Hi togethter,

I wrote a integration for a talend job to is it in the Job Scheduler.

One part of the integration is  a java wrapper to easily call a talend job (because additional you have to solve (depending of your configuration) some problems with the class path.

tBuffetOuput is not possible but may be worth a closer look.

If you would like to have more information you can contact me by PM. I'll publish the code (as open source) as soon I get time to do it ...

Bye
Volker

Offline

#5 2008-11-04 21:15:49

Volker Brehm
Member
1139 posts

Volker Brehm said:

Re: Talend as part of another application

I published a first version of the code at sourceforge http://sourceforge.net/projects/talendjobschedu/.
If you have any question please contact me (until I wrote a documentation).

Bye
Volker

Offline

#6 2009-06-10 09:57:50

efe_lc
Member
17 posts

efe_lc said:

Re: Talend as part of another application

Hi Volker

Nice work you have done there.
I had an analog Wrapper to implements and found your post, and downloaded your source code.

To go further, did you think about how Talend could notify progress to your application.
Some "callback" interface allowing the app to display job progress for instance.

I will try something around tSocketOutput and a RMI listener in app or in the Wrapper.


Regards

Offline

#7 2009-06-10 14:55:26

Morbo
Member
228 posts

Morbo said:

Re: Talend as part of another application

Hi there,
I'am just evaluating the job scheduler Volker was takling about and I was starting to write a wrapper class too.
I didn't test yours yet, but does it works with the new version 3.1.x of Talend, I notice some stuffs changed.
If you have some documentation about it, it would help me too to get started (conventions about context variables and sos params).

I'm deeply interested in any integration of talend job, with other opensource plateforms.
I worked on an GUI TalendJobLauncher based on the .item xml source file to get parameters.

I don't know if there is some neat way to split a talend job in steps a third party product could control, (apart from creating distinct jobs of course).

Regards

Offline

#8 2009-06-10 16:03:18

Morbo
Member
228 posts

Morbo said:

Re: Talend as part of another application

Did anybody tried an integration with http://community.intalio.com/ an open source BPMS ?

Offline

#9 2009-06-11 21:52:35

Volker Brehm
Member
1139 posts

Volker Brehm said:

Re: Talend as part of another application

Hi Morbo,

I didn't test the scheduler with 3.1. But I set it just now on my ToDo list. I can't believe that this will be a big effort. But actual there much work to do at my job and that means less spare time :-|

If you have any detailed question, just ask. I'll monitor this thread (I actual don't manage to read all) but you could also send me a pm.

Bye
Volker

Offline

#10 2009-07-10 13:32:41

n3llyb0y
Member
4 posts

n3llyb0y said:

Re: Talend as part of another application

shong wrote:

7) Type in the Java code in class 'Talend.java' (see screenshot 8)

public class Talend
{
	public static void main(String[] args)
	{

		shong.myjob_0_1.myJob.main(new String[]{});

	}
}

shong

Thanks for that smile

How does one also specify the path to any relevant context files that might be required using this approach? I have seen a few threads about this but nothing from those seems to be helping me very much (they appear to work within batch files but I've not seen mention of them regarding an integrated project).

For example - Talend Open Studio will deliver a properties file such as job/jobname/context/Default.properties. I copy those properties into my project but can't seem to get the job to pick them up using the switch '--context_param file=<project root?>/properties/Default.properties'

Any help appreicated.

cheers,
neil

Offline

#11 2009-07-17 22:59:16

Volker Brehm
Member
1139 posts

Volker Brehm said:

Re: Talend as part of another application

Hi neil,

sorry for my late answer. I never used --context_param option. But your job will search inside the classpath for the file. So you must ensure that even your properties files are in the cp.

Bye
Volker

Offline

#12 2009-09-17 12:23:28

vitor_lopes
Member
26 posts

vitor_lopes said:

Re: Talend as part of another application

Hi,

How can I compile/modify and run my job outside Talend?

I'm fairly new to Java but what I want do to is to modify my job so that it prompts the user to enter dates to be used in the tGoogleAnalytics component. And I think I can only do this outside Talend(?).


Thanks.


Regards,
VL

Offline

#13 2009-09-17 14:04:35

Morbo
Member
228 posts

Morbo said:

Re: Talend as part of another application

Hello,
U could use a tJava with :

context.myValue = javax.swing.JOptionPane.showInputDialog("Please input a value");

Last edited by Morbo (2009-09-17 14:04:56)

Offline

#14 2009-09-17 14:29:54

vitor_lopes
Member
26 posts

vitor_lopes said:

Re: Talend as part of another application

Thanks Morbo.

That might do the trick, however, how do I make the components wait for the user input?


(sorry if this is getting a bit off topic, I still want to know how to use the generated code in another tool)

Offline

#15 2009-09-17 14:39:34

Morbo
Member
228 posts

Morbo said:

Re: Talend as part of another application

The prompt will block the process until the user confirm the dialog.
I've made an Talend job GUI launcher for exported jobs (with sources included) which asks for context values marked as "prompt". It's a eclipse RCP project, I might publish it someday.

Offline

#16 2009-09-17 14:44:55

vitor_lopes
Member
26 posts

vitor_lopes said:

Re: Talend as part of another application

OK, so maybe my question should be how to rearrange the flow of the components(?).

The tGoogleAnalytics is being run first and, obviously, fires an error.

Again, thank you.





Edit: managed to control the flow with the "OnComponentOk" flow. Is this the right way?

Last edited by vitor_lopes (2009-09-17 14:49:38)

Offline

#17 2009-09-17 15:06:20

Morbo
Member
228 posts

Morbo said:

Re: Talend as part of another application

Place a tjava as the first component, it should be green, then use a trigger "onSubJob ok" to link to the rest of the job.

Offline

#18 2010-06-20 21:06:25

nrowe
Guest

nrowe said:

Re: Talend as part of another application

Can anybody tell us the way to launch a TOS job which uses Default.properties outside of TOS?

#19 2010-06-21 09:44:38

Morbo
Member
228 posts

Morbo said:

Re: Talend as part of another application

I made a GUI job launcher a while ago.
http://www.assembla.com/wiki/show/inser … oblauncher

I didn't test it with the newest version of TOS though.

Offline

#20 2010-06-21 10:58:50

nicolasdiogo
Member
464 posts

nicolasdiogo said:

Re: Talend as part of another application

n3llyb0y wrote:

How does one also specify the path to any relevant context files that might be required using this approach? I have seen a few threads about this but nothing from those seems to be helping me very much (they appear to work within batch files but I've not seen mention of them regarding an integrated project).

For example - Talend Open Studio will deliver a properties file such as job/jobname/context/Default.properties. I copy those properties into my project but can't seem to get the job to pick them up using the switch '--context_param file=<project root?>/properties/Default.properties'

Any help appreicated.

cheers,
neil

i try to use project 'Implicity Loading' and set the properties file to be collected from the OS variable (System.getenv("TALEND_INITIAL_CONTEXT")
the variable has to exist on the server running the job and contain the path to a file like: c:/somefolder/talend_properties/context_default.properties

this contains file variables for a database connection; from this DB i can collect all other variables that i need.

it is handy since all variables can be changed in the DB without editing Talend Jobs.

you have to make sure that any Context that you use are loaded from the DB.

ris it clear?

Nicolas

Last edited by nicolasdiogo (2010-06-21 11:05:32)

Offline

#21 2010-06-21 11:08:30

nicolasdiogo
Member
464 posts

nicolasdiogo said:

Re: Talend as part of another application

Volker Brehm wrote:

I published a first version of the code at sourceforge http://sourceforge.net/projects/talendjobschedu/.
If you have any question please contact me (until I wrote a documentation).

hi Volker,

i had a look on sf.net and i can not find any file related to this project.  could you please post a link to the location of these files?

many thanks,

Nicolas

Offline

#22 2011-02-03 18:37:16

prsilvajr
Member
1 post

prsilvajr said:

Re: Talend as part of another application

Hi

I nedd call Talend inside an java program, but couldn't use.
Can give me more explanation.
I followed all the steps on slides but I can't running after the slides 8 and 9. What
can I be doing wrong?
My java programming don't call the talend.

Thanks!

Offline

#23 2011-03-03 16:36:48

tchassagnette
Guest

tchassagnette said:

Re: Talend as part of another application

I wrote this article on my blog : http://www.tchogy.fr/2011/03/talend-int … tion-j2ee/
It explains how to launch dynamically a job from a J2EE application.

#24 2011-03-03 17:31:33

dangig
Member
32 posts

dangig said:

Re: Talend as part of another application

Nice article!

Thinking of an enhancement for a future version of TOS related to the generated java code of the job... It would be nice to be able to provide hooks to the job (regular property with getter/setter) in order to use dependency injection (and be able to load a Talend job from an application context provided by the Spring Framework). -- More on this in the comment I left on your article.

I like the direction where this is going...

Regards,
Daniel

Last edited by dangig (2011-03-03 17:33:06)


Daniel Giguere
ERP Guru
  T 1.877.664.1023 ext.114

  E daniel.giguere@erpguru.com

Offline

#25 2011-03-08 12:18:47

janhess
Member
1315 posts

janhess said:

Re: Talend as part of another application

tchassagnette wrote:

I wrote this article on my blog : http://www.tchogy.fr/2011/03/talend-int … tion-j2ee/
It explains how to launch dynamically a job from a J2EE application.

Shame it's not in English.

Offline

Board footer

Talend Contributor Agreement - Talend Website Privacy Policy