万本电子书0元读

万本电子书0元读

顶部广告

Scala Reactive Programming电子书

售       价:¥

3人正在读 | 0人评论 9.8

作       者:Rambabu Posa

出  版  社:Packt Publishing

出版时间:2018-02-28

字       数:53.2万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Build fault-tolerant, robust, and distributed applications in Scala About This Book ? Understand and use the concepts of reactive programming to build distributed systems running on multiple nodes. ? Learn how reactive architecture reduces complexity throughout the development process. ? Get to grips with functional reactive programming and Reactive Microservices. Who This Book Is For This book is for Scala developers who would like to build fault-tolerant, scalable distributed systems. No knowledge of Reactive programming is required. What You Will Learn ? Understand the fundamental principles of Reactive and Functional programming ? Develop applications utilizing features of the Akka framework ? Explore techniques to integrate Scala, Akka, and Play together ? Learn about Reactive Streams with real-time use cases ? Develop Reactive Web Applications with Play, Scala, Akka, and Akka Streams ? Develop and deploy Reactive microservices using the Lagom framework and ConductR In Detail 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. Style and approach The book takes a pragmatic approach, showing you how to build a scalable distributed system using Scala and Akka.
目录展开

Title Page

Copyright and Credits

Scala Reactive Programming

Dedication

Packt Upsell

Why subscribe?

PacktPub.com

Contributors

About the author

About the reviewers

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Download the color images

Conventions used

Get in touch

Reviews

Getting Started with Reactive and Functional Programming

Introduction to Reactive

What is Reactive?

What is Reactive programming?

What is a data stream or stream?

RP versus Reactive systems versus Reactive architecture

Event-Driven versus Message-Driven

Benefits of Reactive systems with RP

Functional programming

What is functional programming?

Principles of functional programming

Benefits of functional programming

Functional Reactive programming

Types of RP

Why FP is the best fit for RP

Reactive Manifesto

Need of Reactive Manifesto

Principles of Reactive systems

Message-Driven

Elasticity

Resilience

Responsiveness

Why Reactive Streams specification?

Why is Play Framework the best for Reactive systems?

Reactive systems versus traditional systems

The Java 9 Flow API

Flow API – Publisher

Flow API – Subscriber

Flow API – Subscription

Flow API – Processor

Flow API – Flow

Implementations of Reactive Streams

Lightbend's Reactive Platform

Pivotal's Reactor project

Microsoft's Reactive Extensions (RX)

Netflix's RxJava

Eclipse's Vert.x

Ratpack

How are Reactive Streams born?

Marble diagrams

What is a Marble diagram?

Data transformation

Benefits of Marble diagrams

Rules of Marble diagrams

Important FRP operators

FRP – the map() function Marble diagram

FRP – the flatMap() function Marble diagram

FRP – the merge() function Marble diagram

FRP – the filter() function Marble diagram

FRP – the reduce() function Marble diagram

FRP – the concat() and sorted() functions Marble diagram

Observer pattern versus Reactive pattern

Summary

Functional Scala

Introduction to Scala

The Scala ecosystem

Understanding the Scala Application

Scala REPL

Principles of Scala FP

FP Design Patterns

Scala FP features in action

Immutability

Scala functions

Scala pure functions

Pattern matching

Scala combinators

For-comprehensions

Scala implicits

Implicit parameters

Implicit conversions

Scala anonymous functions

Everything is an expression

Referential transparency

Functions are first-class citizens

Partial functions

Function currying

Higher-Order Functions

Scala tail-recursion

Types of recursions

Benefits of linear recursion

A linear-recursion example

Benefits of tail-recursion

A tail-recursion example

Scala Type class

Benefits of Type classes

Scala Collections in action

Scala List

Scala List Cons operator

Right associative rule

Scala Map

Scala Range

Scala Functional Design Patterns

Scala map() function

Scala flatMap() function

Advantages of flatMap

Scala Monads in action

Scala Option

Scala Either

Scala Case class and object

Benefits of Scala Case class

Scala Traits in action

Trait as an interface

Traits linearization

Linearization rules

Summary

Asynchronous Programming with Scala

Introduction to Scala AP

What is asynchronous?

Differences between asynchronous and synchronous

Benefits of asynchronous programming

Differences between Concurrency and Parallelism

How Scala supports AP

The Scala Future API

Building blocks of the Scala Future API

Benefits of the Scala Future API

The Scala Future

What is a Future in Scala?

The Scala Future API

What is a computation unit?

Future Trait definition

Future Companion object

The complete Scala Future API

Scala Future examples

The Scala Promise

What is a Scala Promise?

The Scala Promise API

Scala Promise examples

Scala ExecutionContext

What is ExecutionContext?

The relationship between Scala Future components

Differences between a Future and a Promise

Scala Future API callbacks

Scala Future API combinators

Scala Future.sequence()

The Scala Async Library

Scala Async API

The Scala Future API in Play Framework

The Scala Future API in the Akka Toolkit

A Scala Future versus a Java Future

Summary

Building Reactive Applications with Akka

Introduction to Akka

What is Akka?

Applications on the JVM (Java Virtual Machine)

Features of Akka

Benefits of Akka (or why do we need Akka?)

Building blocks of the Akka Toolkit

Akka Extensions (or modules)

Akka Clients

Actor Model in-depth

What is the Actor Model?

Principles of the Actor Model (or properties of Actor in the Actor Model)

Issues with the Shared-State Concurrency model

Benefits of the Actor Model

Components of the Actor Model (or building blocks of the Actor Model)

What are the benefits of immutable messages in the Actor Model?

How Akka implements the Actor Model

Other Actor Model implementations

Akka ActorSystem

What is the ActorSystem?

Roles and responsibilities of ActorSystem

How to create an Akka ActorSystem?

How to shut down an Akka ActorSystem?

Components of Akka's ActorSystem

What is materialization and Akka's implementation?

Akka Actors

What is an Actor?

Components of Akka Actor

Akka Actor – ActorRef

Akka Actor – Dispatcher

Benefits of the dispatcher pattern

Akka Actor – Mailbox(MessageQueue)

Akka Actor – Actor

Akka Actor – ActorPath

Actor versus thread

The lifecycle of an Akka Actor

Actor's preStart() lifecycle method

Actor's postStop() lifecycle method

Actor's preRestart() lifecycle method

Actor's postRestart() lifecycle method

Why Actors are lightweight?

Actor basic operations

Defining an Actor

Creating an Actor

Sending messages to an Actor

The tell (!) function

The ask (?) function

Replaying messages from an Actor

Actor to Actor communication

Actor to non-Actor communication

Stopping an Actor

Killing an Actor

Become/unbecoming an Actor

Case object Switch

Supervise an Actor

Akka Supervision

What is supervision?

What is the main goal of Akka's supervision?

Benefits of supervision

Why don't we write exceptions or failures handling in Actor itself?

Rules of Akka Supervision

Akka Supervision strategies

Akka's supervision hierarchy

Actor's Path

What is Akka's Let It Crash model?

Akka HelloWorld Actor example

Akka Actors communicate example

Akka Actor's lifecycle example

Akka parent-child Actors example

Actor's Path versus Reference

Differences between ActorRef and ActorPath

When we execute actorRef.tell (message), what happens internally?

MessageDispatcher

How to configure a dispatcher?

Akka Configuration

Akka SBT Templates

Akka Logging

Business problem

Problem discussion

Akka Actor's implementation

Summary

Adding Reactiveness with RxScala

Introduction to RxScala

Reactive Extensions

Understanding Rx implementations

RxScala

Benefits of Reactive Extensions

Limitations of Reactive Extensions

Building blocks of RxScala

Understanding the Observable

Developing RxScala HelloWorld with an Observable

Observer

Extending RxScala HelloWorld with Observer

Subscriber

Extending RxScala HelloWorld with Subscriber

Subscription

Scheduler

RxScala Marble diagrams

RxScala's map() function

Summary

Extending Applications with Play

Introduction to Play Framework

What is Play Framework?

Features of Play Framework

Benefits of Play Framework

Why Play Framework is so fast?

Clients of Play Framework

Building blocks of Play Framework

Play Routings

Client Request

Controller Action

Routes

Play Controllers

View Templates

Benefits of Twirl Templates

Model and Forms

Other components – services and repositories

Configuration

Play Framework View Template constructs

Twirl View Templates

Twirl Template Constructs

Architecture of Play Framework

The new features of Play Framework

Play Framework 2.5.x features

Play Framework 2.6.x features

Play Application project structure

Play/Scala HelloWorld example

What is Play Dependency Injection (DI)

Benefits of DI

Extend HelloWorld Example With DI

Extending HelloWorld example with Scala Futures

Play Form – Data Model

Play Framework Form API

Play Form – Binding Data

Play Form functions

Play Framework Form-based web application

Extending Play/Scala HelloWorld example with Akka Toolkit

Play Fileupload web application

Summary

Working with Reactive Streams

Introduction to Akka Streams

What is a stream?

Goals of data streaming

What is Akka Streams?

Goals of the Akka Streams API

Features of the Akka Streams API

Benefits of the Akka Streams API

Why do we need Akka Streams and why not just Akka?

Other Reactive Streams implementations

Components of Akka Streams

The Akka Streams API

What is streaming data?

The Akka Streams Source component

The Akka Streams Sink component

The Akka Streams Flow component

RunnableGraph or Graph

Modules of Akka Streams

Akka Materialization

What is materialization?

Akka's Materializer

Akka's ActorMaterializer

Roles and responsibilities of Akka's ActorMaterializer

Akka's Actor versus Akka Stream's ActorMaterializer

Backpressure

The traditional backpressure approach

Push – Fast Producer / Slow Consumer

Pull – Slow Producer/Fast Consumer

The dynamic push/pull model

Akka Streams programming basics

Creating a Source

Creating a Sink

Connect a Source to a Sink

Creating a Flow

Connecting a Source to a Flow to a Sink

Why do we need ActorSystem and ActorMaterializer?

Akka Streams HelloWorld example

Extending the Akka Streams HelloWorld example with the Flow component

HelloWorld example description

Akka Streams GraphDSL

Goal of Akka Streams Graph DSL

Building blocks of Akka Streams Graph DSL

Fan-In functions

Fan-Out functions

Edge operator

An Akka Streams GraphDSL example

Akka Persistence

Akka Persistence features

The ES (Event Sourcing) model

What is an Event?

An Event Stream

Principles of an Event Sourcing (ES) model

Event sourcing

The CQRS pattern

Benefits of CQRS

How Akka Persistence implements CQRS/ES

How to develop Akka Persistence Actors

Step1 – Use the PersistenceActor trait

Step2 – Implement PersistenceActor's receiveRecover

Step3 – Implement PersistenceActor's receiveCommand

Step4 – Implement PersistenceActor's persistenceId

Step5 – Configure our journal details in application.conf

Akka Persistence MongoDB Weather example

Summary

Integrating Akka Streams to Play Application

Akka Streams

Akka Streams revisited

Types of Akka Stream components

Akka Dynamic Streams

MergeHub

BroadcastHub

PartitionHub

Developing Akka Dynamic Streams

Integrating Akka Streams into Play

Designing a Reactive Chat System

Developing the Reactive Chat System

Test Reactive Chat Application

Akka Persistence Query

Building blocks of Akka Persistence App

Developing WF Reactive Akka Persistence App

Testing WF Reactive Akka Persistence App

Summary

Reactive Microservices with Lagom

Introduction to Lagom Framework

What is Lagom Framework?

Features of Lagom Framework

Benefits of Lagom Framework

Drawbacks of monolith architecture

Benefits of microservice architecture

Principles of microservices

Lagom Reactive Platform architecture

Modules of Lagom Framework

Lagom Core modules

Lagom Scala Core modules

Lagom Persistence modules

Lagom Clustering modules

Lagom Kafka modules

Lagom logging module

Building blocks of Lagom Framework

Lagom Service Locator

Lagom Service Gateway

Lagom Service Descriptor

Lagom Framework's identifiers

Lagom ServiceCall in detail

Description

Internal components of Lagom Framework

Kafka with ZooKeeper

Cassandra

Lagom project structure

Lagom System API

Lagom System – implementation

Lagom System – frontend

Lagom Hello Reactive System

Getting Hello Service code

Testing the Hello Reactive System

Lagom Hello Reactive System microservices

Understanding the Hello Service API code

Understanding HelloService implementation code

Developing Lagom WF Reactive System

WF Reactive System architecture

WF Reactive System – Producer API

WF Reactive System – Producer implementation

WF Reactive System – Consumer API

WF Reactive System – Consumer implementation

WF Reactive System – frontend

Testing the WF Reactive System

Summary

Testing Reactive Microservices

Introduction to TDD

What is TDD?

Code Coverage

Benefits of TDD

Unit testing frameworks

ScalaTest

ScalaTest Plus

Benefits of ScalaTest

Unit testing Scala applications

Unit testing Play Framework components

Test HelloWorld without using DI Controller

Test HelloWorld with DI Controller

Unit testing Akka Actors

Akka Toolkit's testing modules

Testing HelloWorld Actor

Unit testing HelloWorldActor (Version 2)

Executing HelloWorld Actor unit tests

Unit testing Akka Streams

Uniting test Akka Streams, with Actor's Testkit

Unit testing Akka Streams with Akka Stream's Testkit

Unit testing Lagom services

The Code Coverage tool

The SCoverage tool

SBT SCoverage plugin

Summary

Managing Microservices in ConductR

Introduction to Lightbend's ConductR

What is ConductR?

Responsibilities of ConductR

Advantages of ConductR

Components of ConductR

ConductR APIs

The Bundle API

The Control API

Installing Lightbend ConductR

Prerequisites

Installing the ConductR CLI

ConductR Sandbox Visualizer

Understanding ConductR Sandbox information

Preparing WF Reactive System for ConductR

ConductRSBT plugin

Mix ConductRApplicationComponents trait

Deploying the WF Reactive System on ConductR

Starting ConductR Sandbox with multinodes

Starting ConductR Sandbox with a single node

Bundle WF Reactive System components

Observing the WF Reactive System bundles

ConductR Bundle descriptor

Loading WF Reactive System bundles

Load wf-producer-impl

Loading wf-consumer-impl

Loading wf-frontend

Running and testing WF Reactive System bundles

Useful ConductR commands

Summary

Reactive Design Patterns and Best Practices

Understanding Design Patterns

Understanding Let-it-Crash

The Circuit Breaker pattern

Understanding the Circuit Breaker pattern

With or without Circuit Breaker

How a Circuit Breaker works

The Sharding Pattern

The Event Sourcing pattern

The Event Streaming Pattern

The Active-Passive Replication Pattern

The Resource Management Design Patterns

The Reactive Resource Loan pattern

The Reactive Resource Pool pattern

Message Flow Patterns

The Request-Response Design Pattern

Understanding the Reactive Design Pattern

Ask Reactive Design Pattern

The Throttling Pattern

The Pull pattern

Reactive System's best practices and tools

Tools

Useful best practices

Prefer tell over ask with Akka Actors

Don't sequentialize Futures

Summary

Scala Plugin for IntelliJ IDEA

Understanding Scala Plugin

How to set up Scala Plugin for IntelliJ IDE

Summary

Installing Robomongo

What is Robomongo?

Setting up Robomongo

How to use Robomongo?

Summary

Other Books You May Enjoy

Leave a review - let other readers know what you think

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部