nothub / TinyEventBus

Tiny and fast pubsub implementation with subscriber priorities and event canceling for Java 8, 11 and 17.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TinyEventBus

maven central LGTM

Tiny and fast pubsub implementation with subscriber priorities and event canceling for Java 8, 11 and 17.


usage
void run() {
    Bus bus = new Bus();
    bus.reg(Sub.of(String.class, System.out::println));
    bus.pub("Hello World!");
}
class Listenable {
    Sub<Long> sub = Sub.of(Long.class, l -> Foo.bar(l));
    void run() {
        Bus bus = new Bus();
        bus.reg(this);
        bus.pub(42L);
    }
}

For more explanation, check the example .

About

Tiny and fast pubsub implementation with subscriber priorities and event canceling for Java 8, 11 and 17.

License:MIT License


Languages

Language:Java 99.4%Language:Makefile 0.6%