A publish event API for vrml library
<dependency>
<groupId>group.rxcloud</groupId>
<artifactId>vrml-eventbus</artifactId>
<version>1.1.4</version>
</dependency>
基于Spring的事件发布监听机制进行的增强API。
支持同步和异步两种模式。
异步模式有以下特性:
- Event的clone
- 异步线程池进行Listener处理
继承event
包中的抽象类,定义要传递的Event对象。
/**
* The process context complete event.
*/
public class MyEvent extends AbstractProcessEvent<AbstractContext, MyEvent> {
/**
* Create a new Abstract Event.
*
* @param source the object on which the event initially occurred (never {@code null})
* @param context the request
* @param response the response
*/
public MyEvent(Object source, AbstractContext context, Response response) {
super(source, context, response);
}
}
继承listener
包中的抽象类,定义Event的Listener对象。
使用@EventListener
进行Event的监听。
public class MyEventListener extends AbstractEventListener {
@EventListener
public void onEvent(MyEvent stepEvent) {
}
}
继承publisher
包中的抽象类,定义Event的Publisher对象。
@Component
public class MyEventPublisher extends AbstractSyncEventPublisher<AbstractMyEvent> {
}
Developer repository can be found here.
<dependency>
<groupId>group.rxcloud</groupId>
<artifactId>vrml-eventbus</artifactId>
<version>1.1.4</version>
</dependency>
A small number of users have reported problems building vrml. Read our contribution guide for details.