azeroth-event轻量级事件驱动框架

介绍Azeroth-Event,一个轻量级的事件驱动框架,支持并发,加速服务处理效率,具备事件发布及异步处理能力。模仿Spring事件驱动模型,实现一对多发布事件触发多个事件处理,支持多个监听者优先级处理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

azeroth-event

Lightweight event-driven framework

开源地址

中文说明/Chinese Documentation

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

  1. Final consistency (consider sql persistence, increase retry mechanism)
  2. Support el dynamic expressions
  3. Code refactoring, responsibilities are more subdivided and easy to expand

2019-01-12 v1.0.0

  1. Support concurrency, accelerate service processing efficiency, event publishing and asynchronous processing capability (disruptor)
  2. In-project service decoupling Observers and publishers do not interfere with each other
  3. Imitate the spring event-driven model. One-to-many release one event to trigger multiple event processing.
  4. 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.
  5. Asynchronous queues support graceful downtime to ensure the reliability of memory channels
  6. 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.

Projects

Disruptor

spring event-driven model

转载于:https://juejin.im/post/5c3ae9b26fb9a049c965e87f

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值