@Retention(value=RUNTIME) @Target(value=METHOD) public @interface AppIntrospectionPoints
This annotation can be used on a single method of the application's main Talon entry point class in place of the following more narrowly scoped annotations:
@AppConfiguredAccessor
@AppCommandHandlerContainersAccessor
@AppEventHandlerContainersAccessor
@AppStatContainersAccessor
@AppInjectionPoint
s
The method annotated with @AppIntrospectionPoints
will be called multiple times
during the lifecycle of the application. The method is called at each of the points
that the corresponding fine grained @*Accessor
method is called. This allows the
applications to construct and add objects to be introspected at appropriate points in the application's
lifecycle. For example, the set of event handler objects supplied by the application may depend on the
value of an @Configured
annotation that is applied to an object supplied by the
the @AppConfiguredAccessor
. To facilitate this the method is called
prior to each of the following operations:
@AppHAPolicy(HAPolicy.EventSourcing) public class OrderProcessingApp { private class NewOrderHandler{ @AppInjectionPoint private volatile AepMessageSender sender @EventHandler public void onNewOrder(NewOrderMessage message) { NewOrderEventMessage event = NewOrderEventMessage.create(); event.setOrderId(message.getOrderId(); sender.sendMessage("order-events", event); } } private class OrderCancelHandler{ @AppStat private final Counter canceledOrders = StatsFactory.createCounterStat("Orders Canceled"); @AppInjectionPoint private volatile AepMessageSender sender; @EventHandler public void onNewOrder(CancelOrderMessage message) { OrderCanceledEventMessage event = OrderCanceledEventMessage.create(); event.setOrderId(message.getOrderId(); sender.sendMessage("order-cancels", event); canceledOrders.increment(); } } private LinkedHashSet
@AppHAPolicy(HAPolicy.StateReplication) public class MyApp { private class AdminCommandHandlers { @Command(name="triggerDiagnosticDump") public String diagnosticDump() { return "Something more useful"; } } @Configured("myapp.enableAdminCommands", defaultValue="false") private boolean enableAdminCommands; private final AdminCommandHandlers adminCommandHandler = AdminCommandHandlers(); @AppIntrospectionPoints public void getIntrospectedObjects(final Set<Object> introspectionPoints) { if(enabledAdminCommands) { introspectionPoints.addAll(adminCommandHandler); } } }
Copyright © 2019 Neeve Research, LLC. All Rights Reserved.