java - 如何使用 Talend Open Studio Data Integration 创建属性文件?

标签 java mule mule-studio talend

我曾经使用 Talend Open Integration studio 创建作业并从 IDE 运行它或将其导出为可执行 jar 文件。但我并没有广泛使用它。 是否可以创建一个包含不同服务器名称和其他变量的外部配置文件,以便在创建 Talend 作业的可执行 jar 文件后,我可以更改配置文本文件并选择不同的数据库服务器或端口选项?

我也使用过 MuleSoft,所以如果有人知道如何使用 MuleSoft 进行此操作,我们将不胜感激。

最佳答案

根据您问题的内容,我会重新表述主题 “如何在 Talend Open Studio Data Integration 作业中读取和使用外部属性文件?”

首先...创建您的属性文件“common.properties”。您可以将其放入(例如)/etc/classpath 或 c:\etc\classpath

属性文件的示例内容

example_property="This is an example property"

在 Talend 项目中创建公共(public)上下文并向该上下文添加相同的属性

enter image description here

创建一个可重用作业来读取属性并加载它们。我们将其称为 Read_Properties。

enter image description here

使用 tFileInputDelimited 组件读取 props 文件。它应该使用“=”作为行分隔符。

enter image description here

它应该有一个包含两列的架构

key, string 
value, string

输出应该发送到 tBufferOutput

现在...保存可重用的作业。

创建一个新作业,example_calling_job。
该工作应该使用公共(public)上下文。 该作业应该有一个预作业步骤,使用 tRunJob 调用属性作业,将行输出发送到 tContextLoad

然后,example_calling_job 中的组件可以使用属性读取器作业加载的上下文变量。

enter image description here

运行 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]

关于java - 如何使用 Talend Open Studio Data Integration 创建属性文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35737724/

相关文章:

java - 用于切换服务器的响应式(Reactive) Webflux - 有好处吗?

apache-camel - Apache Camel 和其他 ESB 产品

javascript - cvc-复合体类型.2.4。发现以元素 'dw:transform-message' 开头的无效内容

mule - 如何将自定义变压器放入变压器调色板

java - 如何在 mule 中为出站 URL 启用 TLSv1.2

java - 当一个没有引用其封闭类的匿名类从实例方法返回时,它有一个对此的引用。为什么?

java - 如果 "else" block 已经返回,我们还需要构建 "if"吗?

java - 如果从 MyApp 调用文件在其他应用程序中查看,文件不会显示其内容

ssl - Mule 2 方式 HTTPS 身份验证

ssl - Mule - java.security.cert.CertificateException : No subject alternative names present