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