spring cloud --rabbitmq--报错:

ERROR 24392 --- o.s.a.r.c.CachingConnectionFactory : Shutdown Signal: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no exchange 'trade.topic' in vhost '/hmall', class-id=60, method-id=40)

或 Failed to check/redeclare auto-delete queue(s).

分析:报错原因就是找不到自己配置的交换机。

1--如果你确保定义交换机和使用时没写错字母:

//定义交换机绑定队列   
 @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "cart.clear.queue", durable = "true"),
            exchange = @Exchange(name = "trade.topic", type = "topic"),
            key = "order.create"
    ))









//在别的服务中使用
 rabbitTemplate.convertAndSend("trade.topic","order.create",createOrderMesDTO);

2--八九成就是配置出问题了,检查yaml文件rabbitmq的配置,确保正确配置如下信息。如果使用默认的虚拟主机virtual-host选项就不需要配置

spring:
  rabbitmq:
    host:  # 你的虚拟机IP
    port: 5672 # 端口
    virtual-host:  # 虚拟主机名
    username:  # 用户名
    password:  # 密码

3--如果使用的是nacos管理配置,要确保正确拉取到了rabbitmq的配置

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值