GithubHelp home page GithubHelp logo

ajaxfan / eventchain Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ftmtshuashua/eventchain

0.0 0.0 0.0 1.18 MB

用于业务与业务之间的关系处理,帮助业务解耦,轻松实现业务级的复用

License: Apache License 2.0

Java 99.90% Batchfile 0.10%

eventchain's Introduction

EventChain

License Apache2.0

EventChain 是一个用于对复杂的业务场景进行解耦的库。

将复杂的业务流程抽象和拆务分为多个相互独立的业流程,其中独立的业务流程称之为Event。然后利用EventChain进行积木式搭建成完整的业务流程。

EventChain

Download

repositories {
    maven { url 'https://www.jitpack.io' }
}

dependencies {
    implementation 'com.github.ftmtshuashua:EventChain:2.0.2'
}

USE

创建业务事件并在之后执行
/**
* 创建一个事件,该事件的入参是一个整形数据,出参也是一个整形数据.
* 内部逻辑将入参平方后结束.
*/
class SimperEvent() : BaseEvent<Int, Int>() { 
    override fun onCall(params: Int) {
        next(params * params)
    }
}

//lesson 1 - 简单使用,并获取执行结果
SimperEvent()
    .listener(OnEventNextListener { println("result:$it") })	//result:4
    .start(2)
	
//lesson 2 - 将多个事件组合求值
SimperEvent()
    .listener(OnEventNextListener { println("result:$it") })	//result:4
    .chain(SimperEvent())
    .listener(OnEventNextListener { println("result:$it") })	//result:16
    .start(2)

eventchain's People

Contributors

ftmtshuashua avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.