Reactive Programming - Reactive Manifesto - Reactive programming specification
Table of Contents
Reactive Manifesto - reactive programming specification - features
Reactive programming is a step towards a reactive system. Since reactive programming and reactive systems are such a large and challenging concept, a group of developers has come up with a manifesto for it.
In 2013, the Reactive Manifesto was created in order to spell out the core principles of reactive programming. The goal was to specify a collection of protocols, methods, and interfaces that can be used to express the essential processes and entities.
From https://reactivemanifesto.org/
There are four fundamental characteristics that a reactive system must have:
- Responsive
- Resilient
- Elastic
- Message Driven
Principles of the specification
- Non-blocking IO
- asynchronous
- stream based communication
- backpressure handling
Communication patterns enabled by reactive programming specification
Reactive programming is Push/Pull hybrid model.
- request <-> response
- Traditional services. You send a request, you receive a response.
- request <-> streaming response
- You send a request. You receive a streaming response.
- Analogies:
- Stock price updates.
- Order a pizza. Get a message when the order is received. Get a message when the pizza is in the oven. Get a message when the pizza is out of the oven. Get a message when the delivery person is at your door. etc.
- streaming-request <-> response
- You send a streaming request.
- We don’t send one http request for each change. Instead, it is a stream of requests.
- Analogies
- Video streaming
- Working on a google doc online.
- Wearing a health monitoring device. It keeps sending biometric values to the service in real time.
- bidirectional streaming
- combination of the two above.
- Analogies:
- Online gaming