Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Reactive Programming in Kotlin

You're reading from   Reactive Programming in Kotlin Design and build non-blocking, asynchronous Kotlin applications with RXKotlin, Reactor-Kotlin, Android, and Spring

Arrow left icon
Product type Paperback
Published in Dec 2017
Publisher Packt
ISBN-13 9781788473026
Length 322 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Rivu Chakraborty Rivu Chakraborty
Author Profile Icon Rivu Chakraborty
Rivu Chakraborty
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. A Short Introduction to Reactive Programming FREE CHAPTER 2. Functional Programming with Kotlin and RxKotlin 3. Observables, Observers, and Subjects 4. Introduction to Backpressure and Flowables 5. Asynchronous Data Operators and Transformations 6. More on Operators and Error Handling 7. Concurrency and Parallel Processing in RxKotlin with Schedulers 8. Testing RxKotlin Applications 9. Resource Management and Extending RxKotlin 10. Introduction to Web Programming with Spring for Kotlin Developers 11. REST APIs with Spring JPA and Hibernate 12. Reactive Kotlin and Android

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)
In this book, we will focus on RxJava and Reactor-kotlin (in the later chapters, on Spring).
You have been reading a chapter from
Reactive Programming in Kotlin
Published in: Dec 2017
Publisher: Packt
ISBN-13: 9781788473026
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image