Exploiting Microservices To The Full with Muon, Reactjs and Redux
This will be a series of articles covering a project to write a simple set of microservices to manage arbitrary environmental sensors in a passive house. The sensors will be fake (for now, at least; eventually I plan to incorporate live sensors) but the interactions between the services will all be as real as they get.
I’ll be using React.JS with Redux and Muon for the browser side of things, and Node.js with Muon for the services. ### Muon?
To quote the muoncore website:
Muon is a polyglot microservices communication toolkit that enables you to easily build microservices in many languages that have richer, more performant and fully reactive communication semantics. You can easily gain access to Muon compatible services written in other languages without having to sacrifice the richnes of communication or performance.
Briefly, Muon is a set of tools and communication protocols to help creating microservices. Its focus on data flow, event-sourcing and streams making it an ideal partner for React/Redux, with its emphasis on similar data flow and events emission between components. It comes complete with a set of existing services to aid that, including an Event Store called Photon and a pluggable UX framework called Molecule (though this is still a work in progress, so I will be avoiding it for now).
Event-sourcing is a difficult paradigm to get your head around, especially if you’ve coming at it from an rpc/RESTful/OAP background. I won’t say it’s the wave of the future (though it is), but I will say that it solves many of the problems that microservices developers might face as their systems expand, chief of these being service discovery, dependency problems and the necessity to modify existing services with new endpoints in order to create new services.
Of course, Muon still includes the option to create RPC endpoints, but as a fall-back for edge cases where the event store isn’t quite up to scratch yet.
For most of my purposes, rpc won’t be necessary.
The Plan
I’ll go into more detail on different steps of the development as necessary, but for now an overview of the plan is as follows:
- Implement a set of services for sensors and sensor data
- Generate a simple visualisation of the data in browser with react/redux
- Implement an auth system using Muoncore Aether
- Create new services to populate a set of rooms and room-sensor relationships for each registered user
The last point in particular will demonstrate one of the clear advantages of event-sourcing.
Tata for now.