Functional Event-Driven Architecture
$34.99
Minimum price
$59.99
Suggested price

Functional Event-Driven Architecture

Powered by Scala 3

About the Book

Explore the event-driven architecture (EDA) in a purely functional way. Learn to design and develop distributed systems that scale. Identify common design patterns in such systems.

In the same spirit of Practical FP in Scala, we will develop a distributed system written in Scala 3 that meets the requirements of a modern software architecture capable of processing billions of events per day at scale powered by Apache Pulsar and Fs2 streams.

The system also includes a Web Sockets service powered by Http4s, and two Web applications (one written in Elm; another in Scala.js), just for fun!

Although the application picks a particular design and implementation, the concepts should easily translate to other designs in the same space that can be built on top of Apache Kafka, Rabbit MQ, or other message brokers.

Additionally, essential reading material is recommended for those who wish to dive deeper into topics such as Distributed Systems, Streaming Systems, Event-Driven Applications, and Observability.

Have a look at the distributed system that supplements this book: https://github.com/gvolpe/trading

  • Share this book

  • Categories

    • Functional Programming
  • Feedback

About the Author

Gabriel Volpe
Gabriel Volpe

Gabriel Volpe is a Software Engineer, specialized in functional programming, from Buenos Aires, Argentina. He has been writing code since 2005, and nowadays writes Haskell & Scala, while keeping reproducible builds via Nix.

Gabriel Volpe

Episode 180

Bundles that include this book

$109.98
Suggested price
$69.99
Bundle Price

Table of Contents

  • Preface
  • Acknowledgments
    • People
    • Software
    • Fonts
  • Prerequisites
    • Reading material
  • How to read this book
    • Conventions used in this book
  • Part I: Concepts
  • 1. Event-driven architecture
    • 1.1 Introduction
      • 1.1.1 What problems does it solve?
      • 1.1.2 When to use it? When not?
    • 1.2 Microservices architecture
      • 1.2.1 Scalability
      • 1.2.2 Fault tolerance
      • 1.2.3 Observability
    • 1.3 CQRS/ES
      • 1.3.1 Commands
      • 1.3.2 Queries
      • 1.3.3 Reads & writes
      • 1.3.4 When to use it? When not?
      • 1.3.5 Frameworks
    • 1.4 Summary
  • 2. Distributed systems
    • 2.1 Challenges
      • 2.1.1 Identifying points of failure
      • 2.1.2 Consistency & availability: CAP theorem
    • 2.2 Idempotence
      • 2.2.1 De-duplication
    • 2.3 Atomic transactions
      • 2.3.1 Distributed locks
    • 2.4 Summary
  • 3. Stateless vs. Stateful
    • 3.1 Stateless services, stateful brokers
      • 3.1.1 Stateful services
      • 3.1.2 Application clustering
    • 3.2 Message-driven architecture
      • 3.2.1 Delivery guarantees
      • 3.2.2 Apache Kafka
      • 3.2.3 Apache Pulsar
      • 3.2.4 What should I use?
    • 3.3 State snapshots
      • 3.3.1 Retention policy
    • 3.4 Schema evolution
      • 3.4.1 Schema compatibility
      • 3.4.2 Versioning strategies
      • 3.4.3 Schema registry
    • 3.5 Summary
  • Part II: Coding
  • 4. Functional programming in Scala 3
    • 4.1 Domain modeling
      • 4.1.1 Typeclass derivation
      • 4.1.2 Newtypes
      • 4.1.3 Refinement types
      • 4.1.3 Orphan instances
    • 4.2 Typeclasses
    • 4.3 HTTP routes
    • 4.4 Effectful context
    • 4.5 Summary
  • 5. Effectful streams
    • 5.1 Finite state machines
    • 5.2 Lifecycle, resource management
    • 5.3 Data pipelines
      • 5.3.1 Real-time
      • 5.3.2 Batching
      • 5.3.3 Analytics
      • 5.3.4 Data source
    • 5.4 Producer-consumer
      • 5.4.1 In-memory via Queue
      • 5.4.2 Distributed via Apache Pulsar
      • 5.4.3 Distributed via Apache Kafka
    • 5.5 Summary
  • Part III: System
  • 6. Trading system (core services)
    • 6.1 Business requirements
      • 6.1.1 Overview
      • 6.1.2 Domain modeling
      • 6.1.3 Shared modules
    • 6.2 Processor
      • 6.2.1 Commands
      • 6.2.2 Events
      • 6.2.3 Command-event relationship
      • 6.2.4 Entry point
      • 6.2.5 FSM
      • 6.2.6 Deep analysis
      • 6.2.7 Scalability
      • 6.2.8 Run
    • 6.3 Alerts
      • 6.3.1 Datatypes
      • 6.3.2 Event-alert relationship
      • 6.3.3 FSM
      • 6.3.4 Entry point
      • 6.3.5 Scalability
      • 6.3.6 Run
    • 6.4 Web Sockets
      • 6.4.1 Datatypes
      • 6.4.2 HTTP routes
      • 6.4.3 Events handler
      • 6.4.4 Unit tests
      • 6.4.5 Entry point
      • 6.4.6 Run
      • 6.4.7 Scalability
      • 6.4.8 Addendum
    • 6.5 Summary
  • 7. Trading system (alt services)
    • 7.1 Snapshots
      • 7.1.1 Scalability
      • 7.1.2 Entry point
      • 7.1.3 FSM
      • 7.1.4 Run
    • 7.2 Forecasts
      • 7.2.1 Commands
      • 7.2.2 Events
      • 7.2.3 Command-event relationship
      • 7.2.4 Engine
      • 7.2.5 SQL store
      • 7.2.6 Scalability
      • 7.2.7 Entry point
      • 7.2.8 Run
    • 7.3 Feed
      • 7.3.1 Generators
      • 7.3.2 Run
    • 7.4 Integration tests
      • 7.4.1 Redis suite
      • 7.4.2 SQL suite
    • 7.5 Summary
  • 8. Trading system (observability)
    • 8.1 Tracing
      • 8.1.1 Distributed
      • 8.1.2 Centralized
    • 8.2 Build & run
      • 8.2.1 Docker compose
      • 8.2.2 Continuous integration
      • 8.2.3 Smoke tests
    • 8.3 Monitoring
      • 8.3.1 Prometheus
      • 8.3.2 Grafana
    • 8.4 Deployment
      • 8.4.1 K8s cluster
      • 8.4.2 Pods management
    • 8.5 Summary

Other books by this author

The Leanpub 60-day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Do Well. Do Good.

Authors have earned$11,707,309writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF, EPUB and/or MOBI files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub