Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
README.md 1.42 KB
Copy Edit Web IDE Raw Blame History
woter authored 2018-07-12 17:35 . Create README.md

fact-bus

当前版本

1.0.0-SNAPSHOT

Maven依赖


<dependency>

<groupId>com.woter.fact</groupId>

<artifactId>fact-bus</artifactId>

<version>1.0.0-SNAPSHOT</version>

</dependency>

功能描述

fact-bus 是基于guava整合spring实现EventBus;主要包括一下几个方面的功能,具体如下:

  • 整合spring,handle支持bean注入;

  • 支持同步异步广播事件;

  • 自动注册及注销handle;

升级日志

暂无

常用功能代码演示

** 示例:导出用户列表 **


public class TestEvent implements BaseEvent{

    private String name;

    public TestEvent(){}

    public TestEvent(String a){
    this.name = a;
    }

    public String getName() {
        return name;
    }


    public void setName(String name) {
        this.name = name;
    }

}



@Component
public class TestEventHandler extends EventAdapter<TestEvent>{

    private static final Logger logger = LoggerFactory.getLogger(EventBusFacade.class);

    @Override
    public boolean process(TestEvent e) {

      logger.info("==================== 收到测试事件 ===================");

      return true;
    }

}


@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:/spring.xml")
public class TestLaunch {

    @Test
    public void testExecute() {

       EventBusFacade.execute(new TestEvent()); //发布事件

    }

}

Comment ( 0 )

Sign in for post a comment