简体   繁体   English

是否可以使用 Spring Cloud Config 将复杂的配置传递给 Spring Cloud 流函数

[英]Is it possible to use Spring Cloud Config to pass complex config to a spring cloud stream function

I have a configuration that is an XML file that may be updated at any time.我有一个配置,它是一个可以随时更新的 XML 文件。 I need to use it in a reactive function that I am using in the cloud data stream.我需要在我在云数据流中使用的反应式函数中使用它。 I was looking into storing it in spring cloud-config and I had a few questions我正在考虑将它存储在 spring cloud-config 中,但我有几个问题

  1. From the documentation it looks like spring cloud-config is used to store data I would see normally in a property file.从文档看来,spring cloud-config 用于存储我通常会在属性文件中看到的数据。 Can I store entire XML files in it?我可以在其中存储整个 XML 文件吗?
  2. In a function that I use with cloud stream 3.0 can I get the current value of the configuration with a @Value annotation?在我与云流 3.0 一起使用的函数中,我可以使用 @Value 注释获取配置的当前值吗? For example例如
@Bean
    public Function<Flux<List<Record>>, Flux<Object>> doWork(@Value("test") String test)

and test would always have the current value of the XML file from the configuration store.和 test 将始终具有来自配置存储的 XML 文件的当前值。

Reactive functions are only invoked once during the initialisation time to effectively setup a stream.响应式函数仅在初始化期间调用一次以有效设置流。 It is different than imperative functions that Are event driven.它不同于事件驱动的命令式函数。 So anything that is passed to it via method signature will only represent whatever the value was during that time.因此,通过方法签名传递给它的任何内容都将仅代表在那段时间内的任何值。

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

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