This tutorial covers extending an existing application with new functionality and support for new event types. The reader
should be proficient in Java, maven, git, Spring and have completed the first lottery tutorial before starting
this tutorial.
Our goal is to demonstrate how Fluxtion code generation makes it easy and cost-effective to add new functionality to
an existing application with confidence.
At the end of this tutorial you should understand:
How to add new event types and behaviours to user functions
How to re-generate the container with new functionality
We will extend the lottery game to include a power lottery game and some additional reporting interfaces the application
can use. The new java classes are built in the same style as previous tutorials with annotations marking the
callbacks. To bind the new classes into the event processor we update the spring config file and run the build
to regenerate the LotteryProcessor
Processing logic
Our design sketches show what we intend to integrate into our system
The spring config is
updated to include the new beans in the event processor
Additional java classes
Our additional classes to add are:
Extended application
Now the new functionality and services are bound in to the generated event processor, the application can be extended
to use the new features in the sample main. Client code is completely hidden from the updates and the new wiring
that has been generated. All the previous functionality works as before and the application behaviour is extended reliably
and with teh minimum of effort.
Running the application
Executing the application produces the following output:
Conclusion
Hopefully you have learnt that extending an application with Fluxtion is simple and saves a lot of developer time.
Existing behaviour is left untouched the automated generation removes many potential errors. All the developer effort
is focused on the adding business logic and creating value.
Comparing the previous generated version with the new version gives the developer to validate the new application
classes are wired in as expected.