The Talon Manual

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

After config injection, the Talon XVM moves onto parsing the application's command handlers. This is done by first using the following method on the application's main class to fetch the set of application objects that contain the application's command handlers and then parse those objects for command handlers. 

 

Code Block
languagejava
@com.neeve.server.app.annotations.AppCommandHandlerContainerAccessor
public void addCommandHandlerContainerObjects(Set<Object> containers) {...}

Discover Command Handlers

Command handler methods are annotated with the @com.neeve.server.app.annotations.AppCommandHandler annotation. The following is an example of a command handler.

Code Block
languagejava
@com.neeve.server.app.annotations.AppCommandHandler(command="printhelloworld")
public String helloWorld(String command, String[] args) {
   System.out.println("Hello World!");
}

After collating all the command handler container objects obtained via the previous step, the server then parses the objects for command handlers.

Note

Command handler container objects can also contain non-command handler methods. Those methods will be ignored by the server command handler parser machinery.

Get AppStat Containers

Along with discovering command handlers, the Talon XVM also discovers additional objects that contain @AppStats. This is done by first using the following method on the application's main class to first fetch the set of application objects that contain the application's AppStats, and then introspecting those objects.  

 

Code Block
languagejava
// Note that the method name is unimportant.
@com.neeve.server.app.annotations.AppStatContainerAccessorAppStatContainersAccessor
public void addAppStatContainerObjects(Set<Object> containers) {...} 

Discover AppStats

AppStats can be be exposed by either methods or fields on the App's main class or in one of the AppStatContainers exposed above by annotating the field or method with the @com.neeve.server.app.annotations.AppStat annotation. Introspection for application stats is done just before the AepEngine is injected into the application. See User-Defined App Stats for additional details. 

Get Event Handler Containers

After parsing the command handlers, the Talon XVM parses the application's event handlers. This is done by using the following method on the application's main class to first fetch the set of application objects that contain the application's event handlers and then parsing those objects for event handlers. 

Code Block
languagejava
@com.neeve.server.app.annotations.AppEventHandlerContainerAccessorAppEventHandlerContainersAccessor
public void addEventHandlerContainerObjects(Set<Object> containers) {...}

Discover Event Handlers

Event handler methods are those that are annotated with the @com.neeve.aep.annotations.EventHandler annotation. Event handlers are single argument methods that contain an event or a message type as their argument. The Talon XVM and AEP engine dispatch events to the application event handlers. The following are some examples of event handlers.

Code Block
languagejava
@com.neeve.aep.annotations.EventHandler
public void onEngineActivated(final com.neeve.aep.event.AepEngineActiveEvent event) {...);
Code Block
languagejava
@com.neeve.aep.annotations.EventHandler
public void onOrder(final NewOrderMessage message) {..};

After collating all the event handler container objects obtained via the previous step, the server then parses the objects for event handlers. The parsed event handlers are used by both the server and the AEP engine to dispatch events to the application.

...