1 Star 2 Fork 1

endink / spring-cloud-stream-binder-memory

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Spring Cloud Stream Binder Memory

使用内存队列作为中间件 的 spring cloud stream 标准实现.

Hex.pm Maven Central

为什么需要这个项目,应用场景是什么?

  1. 贫穷架构:单进程单点部署的程序,因为贫穷的原因,可以节省昂贵的中间件开销。
  2. 演示类场景: 对于 DEMO, 演示程序,项目早期的项目程序,无需中间件也可以使用 spring cloud stream 。
  3. 平滑迁移:无需更改任何代码,仅改变一行配置就可以平滑过度到真正的 "cloud stream" 模式。
  4. 本机开发:代码拿回家,更改一行代码即可本机调试(当然需要你的 Producer 和 Consumer 能够在同一个进程启动)

限制:

Producer 和 Consumer 在同一进程内

如果所有的项目都制作成 spring boot starter (我厂的最佳实践就是这样), 这当然不是问题!

Quick Start

添加依赖

dependencies {
    compile "com.labijie:spring-cloud-stream-binder-memory:1.0.0"
}

使用 spring cloud stream

参考文档: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 中智能提示

祝你使用愉快 !

空文件

简介

spring cloud stream 内存队列实现 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Kotlin
1
https://gitee.com/endink/spring-cloud-stream-binder-memory.git
git@gitee.com:endink/spring-cloud-stream-binder-memory.git
endink
spring-cloud-stream-binder-memory
spring-cloud-stream-binder-memory
master

搜索帮助