Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm trying to pass/store a value from one subjob to be used in another subjob, and am trying to find the best way.
I tried to implement what is described in the below post (pass a Map to the subjob as a context parameter) but ran into unexpected results.
https://www.talendbyexample.com/talend-returning-values-from-subjobs.html
The issue I run into is in the subjob I'm unable to retrieve the context parameter as a Map. When I check the class of context param it is showing it as java.lang.String instead of java.util.concurrent.ConcurrentHashMap. If I use a ContextDump -> LogRow the output seems to indicate it's a Map
Context Parameter Setup
sharedMap (Object)
ParentJob
tJava
context.sharedMap = new java.util.concurrent.ConcurrentHashMap();
sharedMap.getClass().getName() = java.util.concurrent.ConcurrentHashMap
SubJob
Options
sharedMap.getClass().getName() = java.lang.String
ContextDump -> LogRow results indicate the value appears to be a Map
|sharedMap |{parentJob=parentJob value} |
Follow-up questions:
* Why does the Object context param get converted to String when passed to the subjob?
* Is there a different/better way I should be handling what I'm trying to do? I can't store the value in a globalMap because the globalMap only applies to the job being run.