Event Handler

Event Handler is a method that reacts on a domain event after it is posted to the Event Bus. Unlike Event Appliers, event handlers must be declared public:

@Subscribe
public void on(MyEvent event, EventContext context) {
    // do something
}

A handler method must be annotated with @Subscribe.

It must have two parameters. The class of the event will be indicated by the first parameter.

The second parameter must be an event context — the meta-information on the event.

If the annotation is applied to a method with less or more than two parameters, the method will not be registered for event delivery from EventBus.

results matching ""

    No results matching ""