Skip to content

twentwo/fresno

Repository files navigation

fresno

A Disruptor + Redis Queue

draw inspiration from https://github.com/zhangkaitao

Architecture

a-disrupt-redis-queue

Usage

spring-boot application support

Maven

maven dependency import

<dependency>
  <groupId>io.yec</groupId>
  <artifactId>fresno-spring-boot-starter</artifactId>
  <version>${fresno.version}</version>
</dependency>

EventHandler

define EventHandler

@EventHandler
public class OrderEventListener implements EventListener<Order> {

    @Resource
    private FooService fooService;

    @Override
    public void onEvent(EventQueue<Order> eventQueue, Event<Order> event) {
        try {
            fooService.getOrder(event.getObj());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}

EventQueueReference

reference EventQueue

@Service
public class FooServiceImpl implements FooService {

    @EventQueueReference(belongTo = OrderEventListener.class)
    private EventQueue<Order> orderEventQueue;

    @Override
    public void enQueueOrder(Order order) {
        log.info("enQueueOrder :: {}", order);
        orderEventQueue.enqueueToBack(order);
    }
}

About

A Disruptor + Redis Queue

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages