如何使用Talend Open Studio数据集成创建属性文件? [英] How can a properties file be created using Talend Open Studio Data Integration?
问题描述
我曾经使用过Talend Open Integration studio来创建作业并从IDE运行它或将其导出为可执行jar文件。但我没有广泛使用它。
是否可以创建一个包含不同服务器名称和其他变量的外部配置文件,以便在创建我的Talend作业的可执行jar文件后,我可以更改配置文本文件并选择不同的数据库服务器或端口选项?
I've used Talend Open Integration studio for sometime to just create jobs and run it from the IDE or export it as executable jar file. But I haven't used it extensively. Is it possible to create an external configuration file that holds different server names and other variables so that after I create an executable jar file of my Talend job, I can just change configuration text file and select different database servers or port options?
我也使用了MuleSoft一点点,所以如果有人知道如何使用MuleSoft,任何建议都会受到赞赏。
I also used MuleSoft for a little bit, so if anyone knows how to do this with MuleSoft any advise would be kindly appreciated.
推荐答案
从你问题的内容,我将改写主题
如何读取外部属性文件并在Talend Open Studio数据集成工作中使用?
From the content of your question, I would rephrase the subject "How can an external properties file be read and used in a Talend Open Studio Data Integration job?"
首先......创建属性文件common.properties。您可以将它放在(例如)/ etc / classpath或c:\ etcc \classpath
First... create your properties file, "common.properties". You could put it in (for example) /etc/classpath, or c:\etc\classpath
属性文件的示例内容
example_property="This is an example property"
在Talend Project中创建一个公共上下文并将相同的属性添加到上下文中
Create a common context in the Talend Project and add the same properties to the context
创建一个可重复使用的作业来读取属性并加载它们。我们称之为Read_ Properties。
Create a re-usable job to read the properties and load them. Let's call it Read_ Properties.
使用tFileInputDelimited组件读取道具文件。它应该使用=作为行分隔符。
Use a tFileInputDelimited component to read the props file. It should use "=" as the row separator.
它应该有一个包含两列的模式
It should have a schema with two columns
key, string
value, string
输出应该转到tBufferOutput
The output should go to a tBufferOutput
现在......保存可重复使用的作业。
Now... save that reusable job.
创建一个新作业example_calling_job。
该作业应该使用Common上下文。
该作业应该有一个prejob步骤,使用tRunJob调用属性作业,将行输出发送到tContextLoad
Create a new job, example_calling_job.
That job should should use the Common context.
That job should have a prejob step, call the properties job with tRunJob, send row output to a tContextLoad
然后,example_calling_job中的组件可以使用由属性读取器作业加载的上下文变量。
Then, your component in the example_calling_job can use the context variables which were loaded by the property reader job.
运行example_calling_job。 tJava组件写出context.example_property值,该值由属性读取器作业加载到上下文变量中。
Run the example_calling_job. The tJava component writes out the context.example_property value, which was loaded by the property reader job into the context variable.
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]
这篇关于如何使用Talend Open Studio数据集成创建属性文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!