SpringCloud Stream集成Rocketmq

本文介绍了如何在SpringCloud Stream中集成RocketMQ,包括引入依赖、配置application.properties、设置消费者和生产者的通道名称,并提供了消费者和生产者的代码实现。
摘要由CSDN通过智能技术生成

SpringCloud Stream集成Rocketmq

首先需要引入依赖包

项目使用gradle进行构建依赖包如下:

//spring cloud stream

compile('com.alibaba.cloud:spring-cloud-starter-stream-rocketmq:2.2.1.RELEASE')

application.properties配置如下

#rocketmq服务地址,集群多台用';'分隔

spring.cloud.stream.rocketmq.binder.name-server=127.0.0.1:9876

#生产者

#指定生产者发送的topic名称

spring.cloud.stream.bindings.ccAdminServiceMessageOut.destination=comment-topic-comment-insert

#指定编码类型

spring.cloud.stream.bindings.ccAdminServiceMessageOut.content-type=application/json

#消费者

#指定消费的topic名称

spring.cloud.stream.bindings.ccAdminServiceCommentIn.destination=comment-topic-comment-insert

#指定编码类型

spring.cloud.stream.bindings.ccAdminServiceCommentIn.content-type=application/json

#指定分组名称

spring.cloud.stream.bindings.ccAdminServiceCommentIn.group=cc-admin-comment-consumer-group

其中ccAdminServiceCommentIn与ccAdminServiceMessageOu

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值