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