1 Star 0 Fork 50

邓华锋 / folkmq

forked from noear / folkmq 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

FolkMQ

一个内存型消息中间件(支持快照持久化、Broker 集群)

Maven Apache 2 jdk-8 jdk-11 jdk-17 jdk-21
gitee star github star



简介

  • 采用 "内存运行" + "快照持久化" + "Broker 集群模式"(可选)
  • 可以 增加基于 ws,udp 的通讯(或许,也可用于物联网)
角色 功能
生产端 发布消息(Qos0、Qos1)、发布定时消息(Qos0、Qos1)、发布重试
消费端 订阅、取消订阅
消费端 消费-ACK
服务端 派发-Retry、派发-Delayed
服务端 内存运行、快照持久化(自动、停机、手动)

特点

  • 快、是真的快(大约 100_000 TPS)。有点像 Redis 之于 MySql。

//使用 MacBook pro 2020 + JDK8 本机测试,单客户端发与收(跑分难免有波动,我是选了好看点的)

  • 简单的管理后台

加入到社区交流群

QQ交流群:316697724 微信交流群(申请时输入:FolkMQ)

开发过程视频记录

你好世界!

1、启动服务 (更多部署参考:部署说明)

docker run -p 18602:18602 -p 8602:8602 noearorg/folkmq-server:1.0.12 

2、编写客户端代码

  • maven import
<dependencies>
    <!-- 可选包:java-tcp(90kb左右), smartsocket(260Kb左右), netty(2.5Mb左右) -->
    <dependency>
        <groupId>org.noear</groupId>
        <artifactId>folkmq-transport-java-tcp</artifactId>
        <version>1.0.12</version>
    </dependency>
</dependencies>
  • client(consumer + producer) use
public class ClientDemo1 {
    public static void main(String[] args) throws Exception {
        //客户端(鉴权为可选。服务端,不添加则不鉴权)
        MqClient client = FolkMQ.createClient("folkmq://127.0.0.1:18602?ak=folkmq&sk=YapLHTx19RlsEE16")
                .connect();

        //订阅(consumer = ip or cluster name)
        client.subscribe("demo", "demoapp", message -> {
            System.out.println(message);
        });

        //发布
        client.publish("demo", "helloworld!").get();
    }
}

消费自动重试与延时策略

派发次数 自动延时
0 0s 相当于马上发
1 5s
2 30s
3 3m
4 9m
5 15m
6 30m
7 1h
n.. 2h 第8次之后都是2小时

客户端主要接口字典

详见:《API.md》

架构图

BSD 3-Clause License Copyright (c) 2023, 西东 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

FolkMQ,是内存型消息中间件(大约 100K TPS)。支持"快照持久化"和"Broker 集群模式"! 展开 收起
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/denghuafeng/folkmq.git
git@gitee.com:denghuafeng/folkmq.git
denghuafeng
folkmq
folkmq
main

搜索帮助

53164aa7 5694891 3bd8fe86 5694891