Book Image

Scala Reactive Programming

By : Rambabu Posa
Book Image

Scala Reactive Programming

By: Rambabu Posa

Overview of this book

Reactive programming is a scalable, fast way to build applications, and one that helps us write code that is concise, clear, and readable. It can be used for many purposes such as GUIs, robotics, music, and others, and is central to many concurrent systems. This book will be your guide to getting started with Reactive programming in Scala. You will begin with the fundamental concepts of Reactive programming and gradually move on to working with asynchronous data streams. You will then start building an application using Akka Actors and extend it using the Play framework. You will also learn about reactive stream specifications, event sourcing techniques, and different methods to integrate Akka Streams into the Play Framework. This book will also take you one step forward by showing you the advantages of the Lagom framework while working with reactive microservices. You will also learn to scale applications using multi-node clusters and test, secure, and deploy your microservices to the cloud. By the end of the book, you will have gained the knowledge to build robust and distributed systems with Scala and Akka.
Table of Contents (16 chapters)

Implementations of Reactive Streams

In this section, we will discuss the most important and popular Reactive Streams Specification implementations, Reactive Technologies, and so on.

Lightbend's Reactive Platform

Lightbend's Reactive Platform is one of the popular technology stacks that support the FRP paradigm. Lightbend is one of the initiators of the Reactive Streams Specification. This platform has a Reactive microservice framework known as the Lagom framework.

The Lagom framework uses Scala, Play, and Akka Toolkit to develop Reactive systems, Reactive Web Applications, or Reactive microservices. It is a pure FRP Solution.

The Akka Toolkit has an API known as the Akka Streams API, which implements the Reactive Streams Specification.

In this book, we will use this technology stack to develop our Reactive system. Go through subsequent chapters to understand how to easily develop data streaming applications using Akka Streams and how to develop Reactive microservices using the Lagom framework.

Pivotal's Reactor project

The Pivotal team has developed a new module to support RP features, which is known as Reactor. They have released it as part of Spring Framework 5.x.

The Spring Framework is a Java framework to develop web applications, microserivces, and more. Its 5.x version is built on the Reactor module and also supports the API to develop Reactive applications. This module builds directly on the Reactive Streams Specification, so we don't need to use any bridge or adapters. Spring Framework has another module known as Reactor IO, which provides wrappers around low-level network runtimes, such as Netty and Aeron.

Microsoft's Reactive Extensions (RX)

Microsoft has implemented one Reactive Solution for C# (.Net platform) known as Reactive Extensions. It supports Reactive programming very well.

Reactive Extensions, Rx, or ReactiveX is a library to support asynchronous event-based programming, which has become a base library for other Rx libraries.

Netflix's RxJava

By following Microsoft's Rx library, Netflix has developed their own Rx library for the Java programming language, that is, RxJava.

RxJava stands for Reactive Extensions for Java. It became a base library for other JVM (Java Virtual Machine) languages. Many people have developed some adapters on top of this library.

For instance, RxScala is an Rx library for the Scala programming language. We will discuss Rx and the RxScala framework further in Chapter 5, Adding Reactiveness with RxScala.

Eclipse's Vert.x

Vert.x is an Eclipse Foundation project to support an Event-Driven paradigm on the JVM. Reactive support in Vert.x is similar to Ratpack. Vert.x allows us to use either RxJava or Eclipse native implementation of the Reactive Streams API to develop Reactive systems.

The Eclipse Vert.X website can be found at http://vertx.io/.

We can find its source code at https://github.com/eclipse/vert.x.

Ratpack

Ratpack is a set of Java libraries for building modern high-performance HTTP applications. It provides a basic implementation of the Reactive Streams specification. However, it is not designed to be a fully-featured RP Framework or toolkit.

We can get more information about Ratpack at https://ratpack.io/.