azeroth-event
Lightweight event-driven framework
Structure diagram
Quick start
// init eventbus plugin
EventBus plugin = new EventBus();
//Asynchronous globally enabled, if not enabled by default, synchronous blocking processing
plugin.async(1024, 8);
// Scan the class that contains the @Listener annotation method AND Implement the ApplicationEventListener interface
//Set the scan jar package to include the imported third-party jar package, which is not scanned by default.
plugin.scanJar();
// Set the default scan packet life, the default full scan
plugin.scanPackage("com.github.edagarli.eventbus.listener");
// plugin start
plugin.start();
// send the first message
plugin.publish("123", new EventSource("test"));
// send the second message
plugin.publish("123", new EventSource("test111111"));
// One-to-many, one event, triggering multiple event processing
// Coexisting multiple events with the same tag. Providing priority processing. The smaller the value of priority, the greater the priority.
plugin.publish("test", new EventSource("123123"));
Awaitility.await().atMost(2, TimeUnit.MINUTES).until(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return eventBus.stop();
}
});
複製程式碼
maven jar~
<dependency>
<groupId>com.github.edagarli</groupId>
<artifactId>azeroth-event</artifactId>
<version>1.0.0</version>
</dependency>
複製程式碼
Release Notes
TODO
- Final consistency (consider sql persistence, increase retry mechanism)
- Support el dynamic expressions
- Code refactoring, responsibilities are more subdivided and easy to expand
2019-01-12 v1.0.0
- Support concurrency, accelerate service processing efficiency, event publishing and asynchronous processing capability (disruptor)
- In-project service decoupling Observers and publishers do not interfere with each other
- Imitate the spring event-driven model. One-to-many release one event to trigger multiple event processing.
- Add multiple listener priority processing rights. In the case of asynchronous processing, the order of submission is guaranteed, and the order of execution is not guaranteed.
- Asynchronous queues support graceful downtime to ensure the reliability of memory channels
- Increase the threshold. In asynchronous mode, the ringbuffer exceeds the threshold. Automatically switch back to synchronous. Return to normal and switch to asynchronous mode again.