Reactive Manifesto
So, what is the Reactive Manifesto? The Reactive Manifesto (http://www.reactivemanifesto.org) is a document defining the four reactive principles. You can think of it as the map to the treasure of reactive programming, or like the bible for the programmers of the reactive programming religion.
Everyone starting with reactive programming should have a read of the manifesto to understand what reactive programming is all about and what its principles are.
So, the following is the gist of four principles that Reactive Manifesto defines:
- Responsive: The system responds in a timely manner. Responsive systems focus on providing rapid and consistent response times, so they deliver a consistent quality of service.
- Resilient: In case the system faces any failure, it stays responsive. Resilience is achieved by replication, containment, isolation, and delegation. Failures are contained within each component, isolating components from each other, so when failure has occurred in a component, it will not affect the other components or the system as a whole.
- Elastic: Reactive systems can react to changes and stay responsive under varying workload. They achieve elasticity in a cost effective way on commodity hardware and software platforms.
- Message driven: In order to establish the resilient principle, reactive systems need to establish a boundary between components by relying on asynchronous message passing.
By implementing all four preceding principles, the system becomes reliable and responsive thus, reactive.
Reactive Streams standard specifications
Along with the Reactive Manifesto, we also have a standard specification on Reactive Streams. Everything in the reactive world is accomplished with the help of Reactive Streams. In 2013, Netflix, Pivotal, and Lightbend (previously known as Typesafe) felt a need for a standards specification for Reactive Streams as the reactive programming was beginning to spread and more frameworks for reactive programming were starting to emerge, so they started the initiative that resulted in Reactive Streams standard specification, which is now getting implemented across various frameworks and platforms.
You can take a look at the Reactive Streams standard specification at—http://www.reactive-streams.org/.
Reactive Frameworks for Kotlin
To write Reactive programs, we need a library or a specific programming language; we can't refer to Kotlin as a reactive language (basically, I don't know any such language that is reactive by itself) as it is a powerful and flexible programming language for modern multiplatform applications, fully interoperable with Java and Android. However, there are reactive libraries out there to help us with these. So, let's take a look at the available list:
- RxKotlin
- Reactor-Kotlin
- Redux-Kotlin
- FunKTionale
- RxJava and other Reactive Java Frameworks can also be used with Kotlin (as Kotlin is 100% interoperable with Java-bidirectional)
Note
In this book, we will focus on RxJava and Reactor-kotlin (in the later chapters, on Spring).