The Reactica roller coaster is the latest addition to Coderland, our fictitious amusement park for developers. It illustrates the power of reactive computing, an important architecture for working with groups of microservices that use asynchronous data to work with each other.
In this scenario, we need to build a web app to display the constantly updated wait time for the coaster.
The Reactica roller coaster
The different microservices in the exercise produce events such as:
- A guest gets in line for the coaster.
- A guest gets on the coaster.
- A guest gets off the coaster.
- A ride starts, carrying some number of guests and changing the status of those guests from "in line" to "on the ride."
- A ride stops, changing the status of some number of guests to "completed the ride."
The scenario uses Red Hat AMQ and Red Hat Data Grid to do its work. There is a component that generates new User
objects that get in line and new Ride
objects that take some User
s on the ride. The data about those User
s is stored in AMQ and the data grid; the details of the Ride
objects are stored in AMQ. From there, we have several components that watch the data grid and AMQ to change the status of the User
and Ride
objects over time.
The coaster illustrates the basic definition of reactive programming, as defined in Andre Staltz's reactive tutorial:
Reactive programming is programming with asynchronous data streams.
By going through the articles and tutorials that accompany the Reactica repo, you can see how the microservices work together. You can also see the reactive principles of responsiveness and resiliency by stopping parts of the system. The rest of the system keeps working, and you can restart parts of the system and see how the whole application continues to work, recovering data that was created but not propagated across the system while some microservices were down.
Overall, we think it's a great introduction to reactive programming. And it's a lot of fun; we really enjoyed putting this content together and we hope you like it as well. As always, we'd love to hear your feedback. You can leave comments in the articles or the YouTube videos, and contact us at coderland@redhat.com.
Enjoy your visit to Coderland!
Last updated: March 28, 2023