Talend:如何从tESBProviderResponse中的tRunJob返回值?

时间:2018-02-19 18:37:53

标签: talend

在Web服务中运行subjob时是否需要特殊的东西?

我知道我可以通过tRunJob的上下文传递值,并通过tRunJob模式检索值(通过tBufferOutput组件显示)。  但是,从Web服务运行时,这似乎不起作用;即,tESBConsumer调用包含tESBProviderRequest和tESBProviderResponse的服务。通过tRunJob上下文传递值有效但通过tRunJob模式检索值不起作用。在下面的输出中,“service_received_from_child”输出显示来自tRunJob的空值。

[statistics] connecting to socket on port 3744
[statistics] connected
.------------------.
|  client_passed_to_service |
|=----------------=|
|Id                |
|=----------------=|
|a7d0b000000XamBAAS|
'------------------'

.------+------.
|client_received_from_service |
|=-----+-----=|
|Status|CaseId|
|=-----+-----=|
'------+------'

[statistics] disconnected

.------------------.
|  child_received_from_service |
|=----------------=|
|Id                |
|=----------------=|
|a7d0b000000XamBAAS|
'------------------'

.------------------------------------+----------.
|                child_returned_to_service      |
|=-----------------------------------+---------=|
|result                              |case_id   |
|=-----------------------------------+---------=|
|Test: Received Id a7d0b000000XamBAAS|0987654321|
'------------------------------------+----------'

.------------------.
|  service_passed_to_child |
|=----------------=|
|Id                |
|=----------------=|
|a7d0b000000XamBAAS|
'------------------'

.------+-------.
|service_received_from_child |
|=-----+------=|
|result|case_id|
|=-----+------=|
|null  |null   |
'------+-------'

我构建了一个测试父作业来执行相同的子作业并且它正常工作,通过tRunJob上下文传递值并从tRunJob模式中检索值。在下面的输出中,“parent_received_from_child”输出显示了tRunJob的正确结果。

[statistics] connecting to socket on port 4045
[statistics] connected
.------------------.
|  child_received_from_parent |
|=----------------=|
|Id                |
|=----------------=|
|a7d0b000000XamBAAS|
'------------------'

.------------------------------------+----------.
|                child_returned_to_parent       |
|=-----------------------------------+---------=|
|result                              |case_id   |
|=-----------------------------------+---------=|
|Test: Received Id a7d0b000000XamBAAS|0987654321|
'------------------------------------+----------'

.------------------------------------+----------.
|                parent_received_from_child     |
|=-----------------------------------+---------=|
|result                              |case_id   |
|=-----------------------------------+---------=|
|Test: Received Id a7d0b000000XamBAAS|0987654321|
'------------------------------------+----------'

[statistics] disconnected

1 个答案:

答案 0 :(得分:1)

找到答案:似乎输入流不能直接连接到tRunJob,但必须首先通过tFlowToIterate,然后再通过tRunJob。进行此更改后,客户端将收到正确的值。

我猜测因为网络服务连续运行而且每个请求都是新的"行"通过流程,所以需要迭代才能分别处理每个请求(?)