springcloud stram rabbitmq中交换机不显示,消费者无法接受到生产者的消息,有可能是yml文件配置错误,可以参考我的

问题描述:

8802消费者接收不到8801生产者的消息,学习阳哥的springcloud视频遇到的问题,
地址:https://www.bilibili.com/video/BV18E411x7eT?p=88&vd_source=f952edae11aa62200d4e6d3c355d946d

解决方案:

8801中yml文件:(注意要对齐)

server:
  port: 8801
spring:
  application:
    name: cloud-stream-provider
  cloud:
    stream:
      binders:           #绑定rabbitmq的服务信息
        defaultRabbit:   #表示定义的名称,用于binding的整合
          type: rabbit   #消息组件类型
          environment:   #设置rabbitmq的相关的配置环境
            spring:
              rabbitmq:
                host: localhost
                port: 5672
                username: guest
                password: guest
      bindings:
        output:
          destination: studyExchange
          content-type: application/json
          binder: defaultRabbit
eureka:
  client:
    service-url:
      defaultZone: http://localhost:7001/eureka
  instance:
    lease-renewal-interval-in-seconds: 2
    lease-expiration-duration-in-seconds: 5
    instance-id: send-8801.com
    prefer-ip-address: true

8808中yml文件:(注意要对齐)

server:
  port: 8802
spring:
  application:
    name: cloud-stream-consumer
  cloud:
    stream:
      binders:           #绑定rabbitmq的服务信息
        defaultRabbit:   #表示定义的名称,用于binding的整合
          type: rabbit   #消息组件类型
          environment:   #设置rabbitmq的相关的配置环境
            spring:
              rabbitmq:
                host: localhost
                port: 5672
                username: guest
                password: guest
                virtual-host: /
                listener:
                  simple:
                    #消费端
                    concurrency: 5
                    #最大消费端数
                    max-concurrency: 10
                    #自动签收auto  手动 manual
                    acknowledge-mode: manual
                    #限流(海量数据,同时只能过来一条)
                    prefetch: 1 #第一次请求中预处理的消息数量
      bindings:
        input:    #这个名字是一个管道的名称
          destination: studyExchange          #表示要使用的Exchange名称定义
          content-type: application/json
          binder: defaultRabbit
eureka:
  client:
    service-url:
      defaultZone: http://localhost:7001/eureka
  instance:
    lease-renewal-interval-in-seconds: 2
    lease-expiration-duration-in-seconds: 5
    instance-id: receive-8802.com
    prefer-ip-address: true

最后结果:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值