Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oragejuice/finjan
A Java event bus
https://github.com/oragejuice/finjan
Last synced: 19 days ago
JSON representation
A Java event bus
- Host: GitHub
- URL: https://github.com/oragejuice/finjan
- Owner: oragejuice
- Created: 2023-04-19T13:13:05.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-05-17T18:09:39.000Z (over 1 year ago)
- Last Synced: 2024-10-28T15:42:42.050Z (2 months ago)
- Language: Java
- Size: 70.3 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Finjan Event bus
## What is an event bus?
*Finjan* is an event bus that allows for post/subscribe style communication between components.
They're designed to replace large condition managers to call groups of methods.
Listeners are subscribed to the event which then are called when events are posted.## Why use Finjan?
Finjan is a performant and lightweight event bus that simplifies code,
that doesn't heavily rely on java's expensive reflection operations thus making it far more
performant than other popular event busses. In exchange for less runtime safety guarantees.
- simple and lightweight
- performant
- minimal dependencies
Finjan uses runtime class generation with ow2-asm to create invokers to call methods,
which makes it significantly faster than others. However currently it does not contain as
many features or safety guarantees that others do.## How to use Finjan
1. Defining an event listener
```java
class EventBusListener {
//This method will now listen to all RecordUpdateEvent events
@EventHandler
public void onRecordUpdate(RecordUpdateEvent event) {
event.getValue();
//...
}
}
```2. Instantiating an event bus
```java
EventManager eventBus = new EventManager();
```3. subscribe/unsubscribe an instance of the listener
```java
eventBus.subscribe(listener);
eventBus.unsubscribe(listener);```
4. Posting an event
```java
eventBus.post(new RecordUpdateEvent(...));
```