init Handlers
Please write a handler initialization code.
For example:
public void initHandlers() {
handler(this, MyEvent.class, event -> {
System.out.println("This is a handler for MyEvent: " + event.getMessage());
System.out.println("Thread: " + Thread.currentThread().getName());
return Unit.INSTANCE;
});
handler(this, MyReturnableEvent.class, event -> {
System.out.println("This is a handler for MyReturnableEvent: " + event.getMessage());
System.out.println("Thread: " + Thread.currentThread().getName());
return "Hello from returnable handler!";
});
}
Content copied to clipboard