Get started with reactive programming with creative Coderland tutorials
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.
Everything you need to grow your career.
With your free Red Hat Developer program membership, unlock our library of cheat sheets and ebooks on next-generation application development.SIGN UP
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
Users on the ride. The data about those
Users 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
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 firstname.lastname@example.org.
Enjoy your visit to Coderland!