发送的消息主题是output而不是stream-test-topic

来源:9-15 Spring Cloud Stream-编写生产者

L灬Lawliet

2019-08-15

配置文件如图
图片描述
图片描述

写回答

1回答

大目

2019-08-15

您好,视频中的配置如下:

stream:
  rocketmq:
    binder:
      name-server: 127.0.0.1:9876
    bindings:
      output:
        producer:
          transactional: true
          group: tx-add-bonus-group
  bindings:
    output:
      # 用来指定topic
      destination: add-bonus


视频中用的是xxx.bindings.output.destination,你用的是xxx.binders.output.destination。

你的配置根本不存在,所以配置不会生效,于是,Spring Cloud Stream使用了channel的名称(output)作为topic了。


建议:

  1. Stream的配置是比较复杂的,binder/binding啥的一定要区分好。建议对比视频里的配置,并且根据课上介绍的binding、binder分别的作用,猜测配置是放在哪块;

  2. 建议用IDEA或者spring tool suite,否则IDE没有提示的话,你会很蛋疼的。一来工作效率很低,都得自己手写;二来还可能抄错……

0
1
L灬Lawliet
非常感谢!
2019-08-15
共1条回复

Spring Cloud Alibaba微服务从入门到进阶

面向未来微服务:熟练掌握Spring Cloud Alibaba

3085 学习 · 1324 问题

查看课程