SpringCloudStream正在消费者服务启动时创建exchange

SpringCloudStream正在消费者服务启动时创建exchange,spring,microservices,spring-cloud-stream,spring-rabbit,Spring,Microservices,Spring Cloud Stream,Spring Rabbit,我有两个微服务Student和Teacher 在Studentmicroservice中,我正在为exchangeXYZ @Input("XYZ") SubscribableChannel xyz(); 在Teachermicroservice中,我正在将exchangeXYZ配置为fanout 应用程序属性 spring.cloud.stream.rabbit.bindings.XYZ.producer.exchangeType=fanout spring.cloud.stream.bi

我有两个微服务
Student
Teacher

Student
microservice中,我正在为exchange
XYZ

@Input("XYZ")
SubscribableChannel xyz();
Teacher
microservice中,我正在将exchange
XYZ
配置为
fanout

应用程序属性

 spring.cloud.stream.rabbit.bindings.XYZ.producer.exchangeType=fanout
 spring.cloud.stream.bindings.XYZ.contentType=application/json
但我在这里面临的问题是
学生
服务在
教师
服务之前启动,它正在创建
XYZ交换
,类型为
主题
,然后
教师
服务启动给我以下错误:

amqp.rabbit.core.RabbitAdmin - Failed to declare exchange: Exchange [name=XYZ, type=fanout, durable=true, autoDelete=false, internal=false, arguments={}], continuing... com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'type' for exchange 'XYZ' in vhost '/': received 'fanout' but current is 'topic', class-id=40, method-id=10)
amqp.rabbit.core.RabbitAdmin-未能声明交换:交换[name=XYZ,type=fanout,durable=true,autoDelete=false,internal=false,arguments={}],继续。。。com.rabbitmq.client.ShutdownSignalException:通道错误;协议方法:#方法(回复代码=406,回复文本=Premission_失败-vhost'/'中交换'XYZ'的参数'type'不相等:收到'fanout',但当前为'topic',类id=40,方法id=10)

>是否有更改“<代码> Exchange Type <代码> >或删除现有<代码> Exchange < /代码>并创建新<代码> Exchange < /代码>或设置<代码> Exchange Eype PE > <代码> > <输入> <代码>

< p>可考虑通过配置属性禁用Exchange创建:

declareExchange

    Whether to declare the exchange for the destination.

    Default: true.

可以考虑通过配置属性禁用Exchange创建:

declareExchange

    Whether to declare the exchange for the destination.

    Default: true.

您还可以在使用者端设置
交换类型。如果您使用的是自定义交换类型,则两边的交换类型必须相同。找到
exchangeType
,您可以看到它对生产者和消费者都可用。您还可以在消费者端设置
exchangeType
。如果您使用的是自定义交换类型,则两边的交换类型必须相同。找到
exchangeType
,您可以看到它对生产者和消费者都可用。