Skip to content

Latest commit

 

History

History

vrml-eventbus

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Build Status

vrml-eventbus

A publish event API for vrml library

Usage

Maven

<dependency>
    <groupId>group.rxcloud</groupId>
    <artifactId>vrml-eventbus</artifactId>
    <version>1.1.4</version>
</dependency>

Publish Event To Listener

基于Spring的事件发布监听机制进行的增强API。

支持同步和异步两种模式。

异步模式有以下特性:

  • Event的clone
  • 异步线程池进行Listener处理

Define Event

继承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);
    }
}

Listen Event

继承listener包中的抽象类,定义Event的Listener对象。

使用@EventListener进行Event的监听。

public class MyEventListener extends AbstractEventListener {

    @EventListener
    public void onEvent(MyEvent stepEvent) {
        
    }
}

Publish Event

继承publisher包中的抽象类,定义Event的Publisher对象。

@Component
public class MyEventPublisher extends AbstractSyncEventPublisher<AbstractMyEvent> {

}

Example

Unit test

Become a Developer

Developer repository can be found here.

Maven

<dependency>
    <groupId>group.rxcloud</groupId>
    <artifactId>vrml-eventbus</artifactId>
    <version>1.1.4</version>
</dependency>

Contributing

A small number of users have reported problems building vrml. Read our contribution guide for details.