Reader small image

You're reading from  Hands-On Reactive Programming in Spring 5

Product typeBook
Published inOct 2018
Reading LevelIntermediate
PublisherPackt
ISBN-139781787284951
Edition1st Edition
Languages
Tools
Right arrow
Authors (2):
Oleh Dokuka
Oleh Dokuka
author image
Oleh Dokuka

Oleh Dokuka is an experienced software engineer, Pivotal Champion, and one of the top contributors to Project Reactor and Spring Framework. He knows the internals of both frameworks very well and advocates reactive programming with Project Reactor on a daily basis. Along with that, the author applies Spring Framework and Project Reactor in software development, so he knows how to build reactive systems using these technologies.
Read more about Oleh Dokuka

Igor Lozynskyi
Igor Lozynskyi
author image
Igor Lozynskyi

Igor Lozynskyi is a senior Java developer who primarily focuses on developing reliable, scalable, and blazingly fast systems. He has over seven years of experience with the Java platform. He is passionate about interesting and dynamic projects both in life and in software development.
Read more about Igor Lozynskyi

View More author details
Right arrow

Preface

Reactive systems are responsive at all times, which is what most businesses demand. The development of such systems is a complex task and requires a deep understanding of the domain. Fortunately, developers of the Spring Framework have created a new, reactive version of the project.

With Reactive Programming in Spring 5, you'll explore the fascinating process of developing a Reactive system using Spring Framework 5.

This book begins with the foundation of Spring Reactive programming. You will gain an understanding of the possibilities of the framework and learn about the fundamentals of reactivity. Further on, you will study the techniques of reactive programming, learn how to apply them to databases, and use them for cross-server communication. All of these tasks will be applied to a real project example, which will enable you to practice the skills learned.

Get on board with the reactive revolution in Spring 5!

Who this book is for

This book is for Java developers who use Spring to develop their applications and want to be able to build robust and reactive applications that can scale in the cloud. Basic knowledge of distributed systems and asynchronous programming is assumed.

What this book covers

Chapter 1, Why Reactive Spring?, covers the business cases in which reactivity fits very well. You will see why a reactive solution is better than a proactive one. Also, you will get an overview of a few code examples that show different ways of cross-server communication, as well as an understanding of today's business needs and their requirements of the modern Spring Framework.

Chapter 2, Reactive Programming in Spring - Basic Concepts, expands on the potential of reactive programming and its central concepts by means of code examples. The chapter then shows the power of reactive, asynchronous, non-blocking programming in the Spring Framework with code examples, and applies this technique in business cases. You'll garner an overview of the publisher-subscriber model in examples of code, understand the power of reactive Flow events, and learn about the application of these techniques in real-world scenarios.

Chapter 3, Reactive Streams - the New Streams' Standard, concentrates on the problems that are introduced by Reactive Extensions. Code examples are used to explore the different approaches and expand upon the nature of the problems. The chapter also delves into problem-solving and the introduction of the Reactive Streams specification, which introduces new components to the well-known publisher-subscriber model.

Chapter 4, Project Reactor - the Foundation for Reactive Apps, looks at the realization of the reactive library; that is, fully implementing the Reactive Streams specification. Firstly, this chapter emphasizes the advantages of implementing Reactor, and then it takes a survey of the reasons that motivated Spring developers to develop their own new solution. Also, this chapter embraces the fundamentals of this impressive library—here you'll get an understanding of Mono and Flux, as well as the applications for reactive types.

Chapter 5Going Reactive with Spring Boot 2, introduces the Spring 5 reactive modules required for reactive application development. Here you'll learn how to get started with modules, and how Spring Boot 2 helps developers configure applications fast.

Chapter 6, WebFlux Async Non-Blocking Communication, covers the primary module, Spring WebFlux, which is the essential tool for the organization of asynchronous, non-blocking communication with both the user and external services. This chapter gives an overview of the advantages of this module and the comparison with Spring MVC.

Chapter 7, Reactive Database Access, goes into the Spring 5-based reactive programming model for data access. This chapter's emphasis is upon reactive reinforcement in Spring Data modules and explores the features that come out of the box with Spring 5, Reactive Streams, and Project Reactor. In this chapter, you will encounter code that shows a reactive approach for communication with different databases, such as SQL and NoSQL databases.

Chapter 8, Scaling Up with Cloud Streams, will introduce you to the reactive features of Spring Cloud Streams. Before starting to learn about the new brilliant capabilities of the module, you'll be given an overview of business case gaps and the problems that you can be faced with when scaling on different servers. This chapter reveals to you the power of the Spring Cloud solution, covering its implementation via code examples of the relevant Spring Boot 2 configuration.

Chapter 9, Testing the Reactive Application, covers the basics required for reactive pipeline testing. This chapter introduces the Spring 5 Test and Project Reactor Test modules for writing tests. Here you will see how to manipulate the frequency of events, move timelines, enhance thread pools, mock results, and assert passed messages.

Chapter 10, And, Finally, Release It!, is a step-by-step guide to current solution deployment and monitoring. Here you will see how to monitoring reactive microservices, for which Spring 5 modules are required. Also, the chapter covers the tools that will be useful for monitoring the aggregation and display of results.

To get the most out of this book

The development of reactive systems is a complex task, requiring a deep understanding of the domain. A knowledge of distributed systems and asynchronous programming is required.

Download the example code files

You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packt.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Hands-On-Reactive-Programming-in-Spring-5In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "The first call invokes onSubscribe(), which stores Subscription locally and then notifies Publisher about their readiness to receive newsletters via the request() method."

A block of code is set as follows:

@Override
public long maxElementsFromPublisher() {
return 1;
}

Any command-line input or output is written as follows:

./gradlew clean build

Bold: Indicates a new term, an important word, or words that you see onscreen.

Warnings or important notes appear like this.
Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at customercare@packtpub.com.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packt.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packt.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packt.com.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Hands-On Reactive Programming in Spring 5
Published in: Oct 2018Publisher: PacktISBN-13: 9781787284951
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.
undefined
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 $15.99/month. Cancel anytime

Authors (2)

author image
Oleh Dokuka

Oleh Dokuka is an experienced software engineer, Pivotal Champion, and one of the top contributors to Project Reactor and Spring Framework. He knows the internals of both frameworks very well and advocates reactive programming with Project Reactor on a daily basis. Along with that, the author applies Spring Framework and Project Reactor in software development, so he knows how to build reactive systems using these technologies.
Read more about Oleh Dokuka

author image
Igor Lozynskyi

Igor Lozynskyi is a senior Java developer who primarily focuses on developing reliable, scalable, and blazingly fast systems. He has over seven years of experience with the Java platform. He is passionate about interesting and dynamic projects both in life and in software development.
Read more about Igor Lozynskyi