An open API service indexing awesome lists of open source software.

https://github.com/xxdark/ssbus

Supersonic, lightweight event bus
https://github.com/xxdark/ssbus

bus event eventbus java lightweight

Last synced: 6 months ago
JSON representation

Supersonic, lightweight event bus

Awesome Lists containing this project

README

          

# ssbus - Supersonic, lightweight event bus

Example usage:

```Java
public class HelloBusTest {

private static final int N = Integer.MAX_VALUE;

public static void main(String[] args) {
Bus bus = new Bus<>(Event.class);
bus.register(
e -> {
e.message = "Hello from lambdas!";
},
100);
bus.register(EventListener.class);
long now = System.currentTimeMillis();
for (int i = 0; i < N; i++) {
Event e = new Event("Hello, World!");
bus.unsafeFireAndForget(e);
}
System.out.println(System.currentTimeMillis() - now);
}

public static final class EventListener {
@Listener
public static void onEvent(Event e) {
e.message = "Hello from hand-crafted classes!";
}
}

public static final class Event {
String message;

public Event(String message) {
this.message = message;
}
}
}
```

**TODO**:
* **JMH Benchmarks**
* **Java 9+ support**