Four Stars

How to pass the parent values to child job where both tRESTClient(Parent & Child) are different URLs?

Hi All, I'm using talend big data & created the two jobs(parent & child).Both the jobs using tRESTClient with different URLs. In parent Job, getting some values and trying to pass the values to child job.Then I want to store those values(parent & child values ) into mongoDB. Parent URL & Job: https://api.github.com/users/sample/repos & tRESTClient --> tXMLMap --> tBufferOutput --> tRunJob Parent Values: stargazers_count & watchers_count Child URL & Job: https://api.github.com/repos/sample/awesome-ciandcd/commits & tRESTClient --> tXMLMap --> tMongoDBOutput. Child Values: date & message Child Values are directly getting from URL & parent values get through the context variable.But my job stored the parent values as NULL. I've added two screenshots tRunJob configuration & Child tXMLMap Detail. How to pass the parent values to child job where both tRESTClient(Parent & Child) are different URLs? How to store the parent and child values into single mongoDB?
  • Data Integration
9 REPLIES
Eleven Stars

Re: How to pass the parent values to child job where both tRESTClient(Parent & Child) are different URLs?

The screenshots do not appear to be attached

Rilhia Solutions
Four Stars

Re: How to pass the parent values to child job where both tRESTClient(Parent & Child) are different URLs?

 
Eleven Stars

Re: How to pass the parent values to child job where both tRESTClient(Parent & Child) are different URLs?

You will have to pass your values to your child job using Context variables. It looks like you are expecting to pass your flow to the ChildJob. You can only pass one row at a time (unless you wrap all of your rows up into a Context Variable and pass them that way). Use a tFlowToIterate (take a look at the documentation for this) and pass the globalMap variable values to your corresponding ChildJob Context Variables.

Rilhia Solutions
Four Stars

Re: How to pass the parent values to child job where both tRESTClient(Parent & Child) are different URLs?

Yes, I have tried tFlowToIterate. Even though it is flowing NULL values to parent columns in child job & mongoDB too.
Eleven Stars

Re: How to pass the parent values to child job where both tRESTClient(Parent & Child) are different URLs?

I can't see how you are passing your Context Variable values. You are using "Transmit whole context" in your tRunJob, but for this to work you need to make sure you have the same context variables (same by name and type) in both your parent and child jobs. Alternatively you can add hard coded values, parameter values, other context variable values, etc, to the "Context Param" box in the tRunJob.

 

This sounds like either you are not sending your values or they are not being received properly.

Rilhia Solutions
Four Stars

Re: How to pass the parent values to child job where both tRESTClient(Parent & Child) are different URLs?

I have same context variables & type in both parent & child jobs. More over i've assign hard code value to the one of the context variable. It is passing to the child job & stored in DB too. Please find the attachment of tRunJob configuration.
Eleven Stars

Re: How to pass the parent values to child job where both tRESTClient(Parent & Child) are different URLs?

Where are the context variables other than the hard coded "Parkesh" value being set? I think that maybe these are not being set before the the tRunJob

Rilhia Solutions
Four Stars

Re: How to pass the parent values to child job where both tRESTClient(Parent & Child) are different URLs?

This is my parent job context variable list & same variables used in child job too.
Eleven Stars

Re: How to pass the parent values to child job where both tRESTClient(Parent & Child) are different URLs?

They do not have values set. Are you expecting the tFlowToIterate to set them? If so, you have got it slightly wrong. The tFlowToIterate will set what are known as globalMao variables. If the row coming from you tXMLMap component has columns called.....

 

Column1  (class String)

Column2  (class Integer)

Column3  (class Long)

 

.... your globalMap reference to them would be....

 

((String)globalMap.get("Column1"))

((Integer)globalMap.get("Column2"))

((Long)globalMap.get("Column3"))

 

You would add the above code to your corresponding tRunJob's context variable settings.

Rilhia Solutions