Module bus.core

Interface Subscriber

All Superinterfaces:
Comparable<Subscriber>, EventListener

public interface Subscriber extends EventListener, Comparable<Subscriber>
订阅者接口
Since:
Java 17+
Author:
Kimi Liu
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    是否异步执行,默认为false,同步执行
    default int
     
    default int
    获取事件执行顺序,值越小越先执行
    void
    update(Event event)
    当事件发生时的操作
  • Method Details

    • update

      void update(Event event)
      当事件发生时的操作
      Parameters:
      event - 事件对象,根据不同事件,可选是否执行
    • order

      default int order()
      获取事件执行顺序,值越小越先执行
      Returns:
      执行顺序
    • compareTo

      default int compareTo(Subscriber o)
      Specified by:
      compareTo in interface Comparable<Subscriber>
    • async

      default boolean async()
      是否异步执行,默认为false,同步执行
      Returns:
      是否异步执行