根据您问题的内容,我将重新表述主题
“如何在 Talend Open Studio Data Integration 作业中读取和使用外部属性文件?”
首先...创建您的属性文件“common.properties”。您可以将其放入(例如)/etc/classpath 或 c:\etc\classpath
属性文件的示例内容
example_property="This is an example property"
在 Talend 项目中创建公共上下文并向该上下文添加相同的属性
创建一个可重用作业来读取属性并加载它们。我们称之为 Read_Properties。
使用 tFileInputDelimited 组件读取 props 文件。它应该使用“=”作为行分隔符。
它应该有一个包含两列的架构
key, string
value, string
输出应发送至 tBufferOutput
现在...保存那个可重用的作业。
创建一个新作业 example_calling_job。
该工作应该使用公共上下文。
该作业应该有一个预作业步骤,使用 tRunJob 调用属性作业,将行输出发送到 tContextLoad
然后,example_calling_job 中的组件可以使用属性读取器作业加载的上下文变量。
运行 example_calling_job。 tJava 组件写出 context.example_property 值,该值由属性读取器作业加载到上下文变量中。
Starting job example_calling_job at 11:35 02/03/2016.
[statistics] connecting to socket on port 3497
[statistics] connected
This is an example property.
[statistics] disconnected
Job example_calling_job ended at 11:35 02/03/2016. [exit code=0]