Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi community!
In my work we have a process platform (postgresql+php) where all process are registrered with id, name, frecuency, dependencies, log, live execution status, etc.
Now we are migrating every process to TOS, so I'm trying to figure out how to "initiate" a Talend Job with the parameters of our process platform.
We build a routine with our common functions (set parameters, verify if it's time to run, etc.), so we have an object with all that we need.
Now, the problem is that we use "Prejob" component with "tRunJob" to call a childJob for initiate our object... the childJob use tBufferOutput to pass the object to the parent, but it doesn't work. The parent Job don't recieve the object correctly.
If I print (on the parent Job) "objProc.getClass().getName()" I get "java.lang.String"
If I do the same in the childJob, I get "routines.Procesos" (that's correct).
Any clue?
Integer idProc = 10000;
String val = "";
context.objProc = new routines.Procesos(idProc, val);
context.objProc.getClass().getFields()[0].set(context.objProc, 20000); //Field[0] is idProc
context.objProceso = new routines.Procesos(idProceso, valorClave);
row1.objProceso = context.objProceso;
System.out.println("sJob: " + context.objProceso);
System.out.println("++++->" + input_row.objProceso.getClass().getFields()[0].getName());
System.out.println("++++->" + input_row.objProceso.getClass().getFields()[0].get(input_row.objProceso));
routines.Procesos proc = (Procesos)input_row.objProceso;
System.out.println("----> " + proc.idProceso);
Starting job testJob at 09:07 29/09/2016.
[statistics] connecting to socket on port 3905
[statistics] connected
sJob: routines.Procesos@6f539caf
Exception in component tJavaRow_1
++++->CASE_INSENSITIVE_ORDER
++++->java.lang.String$CaseInsensitiveComparator@4783da3f
java.lang.ClassCastException: java.lang.String cannot be cast to routines.Procesos
at capa_adquisicion_ps.testjob_0_1.testJob.tRunJob_1Process(testJob.java:603)
at capa_adquisicion_ps.testjob_0_1.testJob.runJobInTOS(testJob.java:901)
at capa_adquisicion_ps.testjob_0_1.testJob.main(testJob.java:739)
[statistics] disconnected
Job testJob ended at 09:07 29/09/2016. [exit code=1]
public class Procesos {
public Integer idProceso;
public String valorClave;
public Integer statusGlobal;
...
}
public Procesos(int idProceso, String valorClave) {
this.idProceso = idProceso;
this.valorClave = valorClave;
this.creaProceso();
}
public void creaProceso(){
....
}
Integer idProc = 10000;
String val = "";
context.objProc = new routines.Procesos(idProc, val);
context.objProc.getClass().getFields()[0].set(context.objProc, 20000); //Field[0] is idProc