【问题标题】:spring cloud stream multi sink with dynamic destinations具有动态目的地的春季云流多接收器
【发布时间】:2020-10-07 18:49:57
【问题描述】:

我需要为基于 RabbitMQ binder 的 Multisink(多个接收器)应用程序使用动态组名。 好像是 spring.cloud.stream.bindings..group 属性不能在运行时设置。

关于如何去做的任何想法? SPB:2.2.8.RELEASE, spring-cloud-dependencies: Hoxton.SR6 , spring-cloud-stream-dependencies: Horsham.SR6

谢谢,

【问题讨论】:

    标签: spring spring-cloud-stream


    【解决方案1】:

    您可以在那里使用属性占位符...

    spring.cloud.stream.bindings.input-in-0.group=${group.prop:foo}
    

    ...然后在命令行设置属性:

    -Dgroup.prop=bar
    

    【讨论】:

    • Thanx Gary,组名类似于:'sharding: alpha - beta@server - 0'。知道如何转义这个属性值吗?
    • 根据sharding readme,您使用的是伪队列名称,而不是单个分片。在这种情况下,这看起来像 alpha;您将组设置为alpha,设置queueNameGroupOnly=true、bindQueue=false 和declareExchange=false。如果>1 节点上有分片,则每个分片都需要一个活页夹。根据文档,您只能从本地分片消费:How does it work? The plugin will chose the queue from the shard with the least amount of consumers, provided the queue contents are local to the broker you are connected to.
    猜你喜欢
    • 1970-01-01
    • 2019-01-28
    • 2019-06-25
    • 1970-01-01
    • 2018-01-09
    • 1970-01-01
    • 2016-12-29
    • 2018-02-10
    • 1970-01-01
    相关资源
    最近更新 更多