简体   繁体   English

如何在Spring-XD中读取内联属性

[英]How to read inline properties in Spring-XD

I am using below stream from that stream I am passing --properties values as shown below. 我正在从该流中使用下面的流,我正在传递--properties值,如下所示。

stream create myFirstStream --definition "file --dir=C:\\\\input --outputType=text/plain | splitter --expression=payload.split('\\n') > sample-api --environment=DEV > queue:myRequestQueue"
stream deploy myFirstStream --properties "module.sample-api.consumer.maxAttempts=3,module.sample-api.consumer.requeue=false,module.sample-api.consumer.concurrency=3" 

Now I need to read this --properties values in my java code(String-xd). 现在,我需要在我的Java代码(String-xd)中读取此--properties值。 I mean ex.. key="module.sample-api.consumer.maxAttempts" value="3" . 我的意思是ex .. key="module.sample-api.consumer.maxAttempts" value="3"

Those are message bus (deployment) properties and are not available to the module. 这些是消息总线(部署)属性,不适用于该模块。

Module properties (in the stream definition - such as dir in your example) are available in the application context's environment. 模块属性(在流定义中-例如您的示例中的dir )在应用程序上下文的环境中可用。

context.getEnvironment().getProperty("dir")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM