stun4j / stun4j-stf

Flexible transaction framework, orchestration mechanism, delay queue, adaptive batch processing, async task chain with lineage, compensatory workflow, distributed, high performance, easy to use

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stun4J Stf

License

柔性事务、延时队列、可编排、自适应批处理、异步任务链、分布式、极简设计、高可用、高性能、易于使用

稳定版 主要变动 发布日期
1.1.0 引擎重构和优化、支持state的二进制存储和压缩、支持Core和DelayQueue的数据源分离 2023/02/19
1.0.1 兼容较低版本的Spring 2022/06/06
1.0.0 初版发布 2022/06/03

功能特性

  • 柔性事务,基于BASE理论,以本地事务为基石,无惧任何失败(超时、宕机、异常等等)
  • 延时队列,支持秒级时间精度,高吞吐,良好的水平伸缩性
  • 补偿式迷你工作流,简约的DSL编排,主控权依然握于开发者手中
  • 自适应、响应式的批处理机制,天然背压,内置监控
  • 良好的梯度重试机制
  • 支持可靠的、具备血缘关系的异步任务链
  • 极简设计,分布式仅依赖DB,无注册中心强需求、高可用、高可靠,无状态、无Leader
  • 开箱支持MySQL、PostgreSQL、Oracle三大主流关系型数据库
  • 制品为袖珍型jar包,易于使用集成,亦可独立部署

如何获取

方式1:从Maven**仓库获取

在你工程的pom.xml中加入如下片段,即可从maven**仓库获取:

获取专属的spring-boot-starter,便于在spring-boot工程中使用

<dependency>
  <groupId>com.stun4j.boot</groupId>
  <artifactId>stun4j-stf-spring-boot-starter</artifactId>
  <version>1.1.0</version>
</dependency>

或者

获取核心库,直接使用

<dependency>
  <groupId>com.stun4j</groupId>
  <artifactId>stun4j-stf-core</artifactId>
  <version>1.1.0</version>
</dependency>

方式2:通过源码构建

切到项目根目录,在控制台执行如下maven命令:

$ mvn clean package -Dmaven.test.skip=true

构建完成后,会在各自的target目录中生成stun4j-stf-core-<version>.jarstun4j-stf-spring-boot-starter-<version>.jar,放入你工程的classpath即可。spring-boot工程仅需要boot-starter这个jar(stun4j-stf-boot-sample工程提供了具体示例),如果你希望通过low-level api的方式来使用Stf,那么你可以了解并使用core这个jar。

如何使用

核心图解

基本原理

fundamental

水平伸缩和高可用

sha

补偿式工作流

stfs {
  local-vars {
    dp = com.stun4j.stf.sample.domain
  }
  actions {
    acceptReq {
      args = [{use-in:{class:${dp}.Req}}]
    }
    step1Tx {
      args = [{invoke-on-in:{method:getId, class:Long}}, {invoke-on-in:{method:getReqId, class:String}}]
    }
    step2Tx {
      args = [{use-in:{class:${dp}.Tx}}]
    }
    endTx {
      args = [{use-in:{class:${dp}.Tx}}]
    }
    sendNotification {
      oid = bizApp
      args = [{use-in:{class:String}}]
      timeout = 10s
    }
  }
  forwards {
    acceptReq.to = step1Tx
    step1Tx.to = step2Tx
    step2Tx.to = endTx
    endTx.to = sendNotification
  }
}

参与

  • 报告bugs、给到建议反馈,请提交一个issue
  • 参与贡献 改进或新功能,请提交pull request并创建一个issue以便讨论与进度追踪
  • 不吝赐 🌟

感谢

  • 异步任务链使用了transmittable-thread-local这个项目

开源许可协议

本项目采用 Apache Software License, Version 2.0

About

Flexible transaction framework, orchestration mechanism, delay queue, adaptive batch processing, async task chain with lineage, compensatory workflow, distributed, high performance, easy to use

License:Apache License 2.0


Languages

Language:Java 100.0%