Reactive systems and event-driven architecture are becoming essential to application design--and companies are taking note. Reactive systems ensure applications are responsive, resilient, and elastic no matter what failures, latency, or other errors may be occurring, while event-driven architecture offers a flexible and composable option for distributed systems. This practical resource helps you bring these approaches together using Quarkus, a Java framework that greatly simplifies the work developers must undertake for cloud deployments. This book covers how Quarkus 2.0 reactive features allow the smooth development of reactive systems.

Clement Escoffier and Ken Finnigan from Red Hat show you how to take advantage of event-driven and reactive principles to build more robust distributed systems, reducing latency and increasing throughput, particularly in your microservices and serverless applications. Java developers will also get a foundation in Quarkus, enabling you to create truly Kubernetes-native applications for the cloud.

  • Understand the fundamentals of reactive systems and event-driven architecture
  • Learn how to use Quarkus to build reactive applications
  • Combine Quarkus with Apache Kafka or AMQP to build reactive systems
  • Develop microservices that utilize messages with Quarkus for use in event-driven architectures

Table of Contents

  1. I. Reactive and Quarkus Introduction
  2. 1. Reactive in a nutshell
    1. What do we mean by reactive?
    2. Reactive software is not new!
    3. The reactive landscape
    4. Why are reactive architectures so well-suited for Cloud-native applications?
    5. Reactive is not a silver bullet
  3. 2. Introduction to Quarkus
    1. Java on the Cloud
    2. Thorntail example
    3. Quarkus example
    4. The Quarkus Way
    5. Create your first Quarkus application
    6. Kubernetes with Quarkus in 10 minutes
    7. Going native
    8. Conclusion
  4. II. Reactive and Event-Driven Applications
  5. 3. The Dark Side of Distributed Systems
    1. What’s a Distributed System?
    2. The new kids on the block: Cloud-Native and Kubernetes-Native applications
    3. The dark side of distributed systems
    4. The Fallacies of Distributed Computing in a Kubernetes World
    5. A question of timing - The synchronous communication drawback
    6. Summary
  6. 4. Design Principles of Reactive Systems
    1. Reactive Systems 101
    2. Commands and Events
    3. Commands
    4. Events
    5. Messages
    6. Commands vs. Events: an example
    7. Destinations and Space Decoupling
    8. Time-Decoupling
    9. The role of non-blocking Input/Output (I/O)
    10. Blocking Network I/O, threads and concurrency
    11. How non-blocking I/O work?
    12. Reactor pattern and event loop
    13. Anatomy of reactive applications
    14. Summary
  7. 5. Reactive Programming: Taming the Asynchronicity
    1. Asynchronous code and patterns
    2. Using Futures
    3. Project Loom - Virtual Threads and Carrier Threads
    4. Reactive Programming
    5. Streams
    6. Operators
    7. Reactive programming libraries
    8. Reactive Streams and the need for flow control
    9. Buffering items
    10. Dropping items
    11. What is Back-Pressure?
    12. Introducing reactive streams
    13. Be warned; it’s a trap!
    14. Back-pressure in a distributed systems
    15. Summary
  8. III. Building Reactive Applications and Systems with Quarkus
  9. 6. Quarkus - reactive engine
    1. The imperative model
    2. The reactive model
    3. Unification of reactive and imperative
    4. A reactive engine
    5. A reactive programming model
    6. Event-driven architecture with Quarkus
    7. Summary
  10. 7. Mutiny - An event-driven reactive programming API
    1. Why another reactive programming library?
    2. What Makes Mutiny Unique?
    3. Mutiny usage in Quarkus
    4. Uni and Multi
    5. Mutiny and Flow Control
    6. Observing events
    7. Transforming events
    8. Chaining asynchronous actions
    9. Recovering from failure
    10. Combining and Joining items
    11. Selecting items
    12. Collecting items
    13. Summary
  11. 8. HTTP with reactive in mind
    1. The journey of an HTTP request
    2. Say Hello to RESTEasy Reactive!
    3. So, What’s the benefit?
    4. Asynchronous endpoints returning Uni
    5. Dealing with failure and customizing the response
    6. Streaming data
    7. Raw streaming
    8. Streaming JSON Array
    9. Using Server-Sent-Event
    10. Reactive Score
    11. Summary
  12. 9. Accessing data reactively
    1. The problem with data access
    2. Non-blocking interactions with relational database
    3. Using a reactive ORM: Hibernate Reactive
    4. What about noSQL?
    5. Interacting with Redis
    6. Data related events and change data capture
    7. Using Debezium to capture change
    8. Summary
  13. Index