天天看點

SpringCloud Stream內建Rocketmq

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

繼續閱讀