
[英]Bind an alternate exchange to an exchange using spring-cloud-stream
[英]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.