@Retention(value=RUNTIME) @Target(value=METHOD) public @interface AppEventHandlerContainersAccessor
The annotated method must take a Set as its sole method parameter and
populate it with containers containing AppStat annotations.
Note: Consider using @AppIntrospectionPoints
annotation as an alternative to this annotation. The @AppEventHandlerContainersAccessor
is useful in cases where finer grained control of which objects in application should
be scanned for @EventHandler annotations. For large application this
can improve load time, but for smaller applications using @AppIntrospectionPoints
results in less boilerplate code.
@AppHAPolicy(HAPolicy.EventSourcing)
public class OrderProcessingApp {
private NewOrderHandler newOrderHandler = new NewOrderHandler(); //contains event handlers
@AppEventHandlerContainersAccessor
public void getEventHandlers(final Set<Object> eventHandlers) {
eventHandlers.add(newOrderHandler);
}
@EventHandler
public void onOrderCancel(OrderCanceMessage cancelMessage) {
// ...process.
}
}Copyright © 2019 Neeve Research, LLC. All Rights Reserved.