【问题标题】:Configuring dynamic stream input destination name for spring cloud stream aws kinesis binder为 Spring Cloud Stream aws kinesis binder 配置动态流输入目标名称
【发布时间】:2021-01-31 17:41:09
【问题描述】:

有没有办法通过 bean 而不是属性 spring.cloud.stream.bindings.input.destination= 属性来配置消费者流名称?

我们有一个用例,我们希望使用易于更改且无法硬编码的流名称。

我们在运行时没有可用的流名称,但在引导上下文初始化期间已加载并作为属性源属性可用。

【问题讨论】:

    标签: spring spring-cloud-stream


    【解决方案1】:

    你可以在那里使用占位符

    spring.cloud.stream.bindings.input.destination=${destination.name:defaultDest}
    

    然后你可以将它传递为-Ddestination.name=foo

    【讨论】:

    • 嗨,加里,感谢您的回复。如果我们在应用程序启动时有流的名称,这将起作用,但是不幸的是,在 spring 云引导期间,流在属性源中可用。
    • 这成功了!使用占位符拾取可用的属性源属性。
    猜你喜欢
    • 2019-04-19
    • 2019-10-03
    • 1970-01-01
    • 1970-01-01
    • 2019-08-22
    • 2020-04-07
    • 2020-03-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多