Talon provides the machinery to easily build, run and manage micro applications (‘micro app’). A micro app is a lightweight, stateful message processor that resides on a messaging fabric. A micro app stores state as Java objects entirely in local memory and collaborates with other micro apps using transactional message passing via its underlying messaging fabric.
The Talon runtime uses configuration information to connect to the messaging fabric and drive the business logic embodied in the micro app message handlers in an exactly once, fully fault tolerant manner. Application developers just implement message handlers. The Talon runtime dispatches inbound messages to the appropriate handlers, the handlers execute business logic, update state and send outbound messages to downstream apps. Talon enables the following for a developer
- Maintain state as POJOs
- Sends and receive messages as POJOs
- Assume that POJO state updates and outbound message sends performed by a message handler are durable and transactional.
By enabling this, Talon makes it extremely easy for the developer to author streaming, multi-agent apps that are fault tolerant, scalable and perform at memory speeds.
A Simple App
Lets say, for example, a developer would like to write an app that performs the following
- Maintain a counter in its state
- Receive a message, update the counter on receipt of a message and send an outbound message with the updated counter value
To implement such an app using Talon, the developer would do the following:
- Model the app state and messages in XML
- Integrate the X code generator into the app's build process generate message and state POJOs
- Author a message handler that updates the state and sends the outbound message
Thats it. The rest - app lifecycle, message bus connectivity, serialization/deserialization, state persistence, HA, etc - are all taken care of by the Talon runtime.
Model State
The above model defines a state tree with a single root Repository object
- The Repository object contains a single counter field of type long
Model Messages
The above model defines a Message and an Event message.
- Message contains a field named value of type long
- Event contains a field named result of type long.
Convert to POJOs
The above XMLs are converted to POJOs as part of the app's build process. The following illustrates how this is done using the Talon's Maven code generator plugin
Write Application Logic
The following is the message handler that executes the application logic
Thats it! Thats all the developer has to do and you have a fault tolerant, highly performant stateful message processor ready to go.
What is most significant about the code above is how messaging, storage and transaction processing are fully integrated using Java without compromising on the non-functional aspects of the application. The X Platform ensures that the above code is invoked exactly once for an inbound message, is horizontally scalable and fully fault tolerant with zero data loss on process, machine or data center failure. It is this capability to enable fully integrated stateful and collaboration aware code without non-functional compromise that unleashes the full potential and power of multi-agent systems.