mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-05-24 21:36:49 +00:00
chore[event]: event bug document and code comments
This commit is contained in:
@@ -135,8 +135,7 @@ public void onMyNoticeEvent(MyNoticeEvent event) {
|
||||
}
|
||||
|
||||
// fire an event
|
||||
EventBus.syncSubmit(MyNoticeEvent.valueOf("同步事件"));
|
||||
EventBus.asyncSubmit(MyNoticeEvent.valueOf("异步事件"));
|
||||
EventBus.submit(MyNoticeEvent.valueOf("My event"));
|
||||
```
|
||||
|
||||
#### 7. [scheduler](scheduler/README.md) scheduling Framework Based on Cron Expression
|
||||
|
||||
+1
-2
@@ -131,8 +131,7 @@ public void onMyNoticeEvent(MyNoticeEvent event) {
|
||||
}
|
||||
|
||||
// 抛出一个事件
|
||||
EventBus.syncSubmit(MyNoticeEvent.valueOf("同步事件"));
|
||||
EventBus.asyncSubmit(MyNoticeEvent.valueOf("异步事件"));
|
||||
EventBus.submit(MyNoticeEvent.valueOf("我的事件"));
|
||||
```
|
||||
|
||||
#### 7. [scheduler](scheduler/README.md) 基于cron表达式的定时任务调度框架
|
||||
|
||||
@@ -26,18 +26,15 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
@Ignore
|
||||
public class ApplicationTest {
|
||||
|
||||
// 事件总线教程,核心思想是设计模式中的观察者模式
|
||||
// Event Bus tutorial, the core idea is the observer pattern.(核心思想是设计模式中的观察者模式)
|
||||
@Test
|
||||
public void startEventTest() {
|
||||
// 加载配置文件,配置文件中必须引入event
|
||||
// load the configuration file which must import event.(加载配置文件,配置文件中必须引入event)
|
||||
var context = new ClassPathXmlApplicationContext("application.xml");
|
||||
|
||||
// 事件的接受需要在被Spring管理的bean的方法上加上@EventReceiver注解,即可自动注册事件的监听
|
||||
// 参考MyController1中的标准注册方法
|
||||
// see receiver method of MyController1 and MyController2
|
||||
EventBus.submit(MyNoticeEvent.valueOf("我的事件"));
|
||||
|
||||
EventBus.submit(MyNoticeEvent.valueOf("处理事件"));
|
||||
|
||||
// 睡眠3秒,等待异步事件执行完
|
||||
ThreadUtils.sleep(3000);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user