绑定rabbitmq默认交易所到其他交易所

Bind rabbitmq default exchange to other exchange

是否可以将rabbitMq默认交易所绑定到其他交易所?

我想将消息从我的 bar exchange 转发到 default exchange,但我不知道如何。

对于两个自定义交换 - foo 和 bar 它工作正常:

    @Bean
    Binding fooExchangeToBarExchange(FanoutExchange fooExchange, FanoutExchange barExchange) {
        return BindingBuilder.bind(fooExchange).to(barExchange);
    }

但与默认交换类似不起作用

    @Bean
    DirectExchange defaultExchange() {
        return new DirectExchange("");
    }

    @Bean
    Binding defaultExchangeToBarExchange(DirectExchange defaultExchange, FanoutExchange barExchange) {
        return BindingBuilder.bind(defaultExchange).to(barExchange);
    }

不,不允许:

Shutdown Signal: channel error; protocol method: #method<channel.close>(reply-code=403, reply-text=ACCESS_REFUSED - operation not permitted on the default exchange, class-id=40, method-id=30)