代码拉取完成,页面将自动刷新
使用内存队列作为中间件 的 spring cloud stream 标准实现.
Producer 和 Consumer 在同一进程内
如果所有的项目都制作成 spring boot starter (我厂的最佳实践就是这样), 这当然不是问题!
添加依赖
dependencies {
compile "com.labijie:spring-cloud-stream-binder-memory:1.0.0"
}
参考文档:https://docs.spring.io/spring-cloud-stream/docs/current/reference/htmlsingle/
** application.yml 中添加配置 **
spring:
cloud:
stream:
default-binder: memory
bindings:
input:
destination: sms
output:
destination: sms
spring cloud stream 的标准配置模式都支持,这,是一个标准实现!
spring:
cloud:
stream:
memory:
binder:
worker-pool-size: -1
queue-size: 2048
说明:
配置 | 默认值 | 说明 |
---|---|---|
spring.cloud.stream.memory.binder.worker-pool-size | -1 | 工作线程池大小,当小于 0 时使用 CPU 核心数 1 半 |
spring.cloud.stream.memory.binder.queue-size | 2048 | 阻塞队列大小,当队列满了以后将丢弃最早的消息 |
所有的配置都能够在 IDEA 中智能提示
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。