繁体   English   中英

绑定交换以使用Rabbitmq绑定器通过Spring云流进行交换

[英]Bind exchange to exchange through Spring cloud stream with rabbitmq binder

我正在寻找一种通过Spring云流将RabbitMQ交换绑定到另一个交换的方法。 我知道可以通过设置producer.requiredGroups属性将队列绑定到交换:

spring.cloud.stream.bindings.foo.producer.requiredGroups=queueA queueB

我可以使用哪个属性来创建交换绑定?

代替将所需组,加@Bean S为2个exhanges和@Bean的结合。

请参阅Spring AMQP文档

@Bean
public TopicExchange destinatioExchange() {
    return new TopicExchange("myDest");
}

@Bean
public DirectExchange boundExchange() {
    return new DirectExchange("bound");
}

@Bean
public Binding binding() {
    return BindingBuilder
            .bind(boundExchange())
            .to(destinatioExchange())
            .with("myRoutingKey");
}

spring.cloud.stream.bindings.output.destination=myDest
spring.cloud.stream.rabbit.bindings.output.producer.routing-key-expression='myRoutingKey'

暂无
暂无

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

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