Skip to main content

Event-Driven Architecture for Java Developers

Learn how to build Event-Driven systems with a Transactional Outbox and CockroachDB's CDC.

  • Course Number

  • Self-Paced

  • Estimated Effort

    3 hours/week

About This Course

Modern architectures are often built with a series of distributed microservices. They span multiple machines, often in different data centers. They communicate using asynchronous events that are pushed to a message queue. However, these systems face some key challenges. They’re built to be distributed, but they often run against non-distributed databases which limits elasticity and resilience. Meanwhile, those that run against distributed, nontransactional databases are faced with the problem of updating a message queue consistently with the state of the database. What if one of those operations fails?

This is where Distributed SQL comes in. CockroachDB provides us with a fully distributed database that includes support for transactions. It allows us to scale our database to match the needs of our system, but also to publish events from our microservices in a way that will be consistent and resilient to failures.

In this course, you’ll learn about the Dual-Write problem, and how you can use the Transactional Outbox Pattern to avoid it. You'll see some best practices and anti-patterns for working with Event-Driven systems. And you'll learn about some features of CockroachDB, such as Change Data Capture (CDC), that can simplify your architecture.

You'll be implementing these ideas using the Spring Data JPA framework, along with Spring Boot. You'll modify a series of microservices so that events emitted from one service can be consumed in another. And you'll do all of this using CockroachDB so that your system can scale from the database all the way through to the application.


  • Java
  • Spring Data
  • Spring Boot

Detailed course outline

  • Chapter 1: Introduction
    • Video: The dual-write problem
    • Exercises: Setup
      • Environment setup
      • Getting started with MovR
  • Chapter 2: The Transactional Outbox Pattern
    • Video: The Transactional Outbox Pattern
    • Quiz: The Transactional Outbox Pattern
    • Video: What is an Event
    • Quiz: What is an Event
    • Video: The Outbox Table
    • Quiz: The Outbox Table
    • Exercise: Create the Outbox Table
  • Chapter 3: Publishing Events
    • Video: Using the Event Log
    • Quiz: Using the Event Log
    • Video: Revealing Intent
    • Quiz: Revealing Intent
    • Exercise: Publish the Ride Started Event
  • Chapter 4: Change Data Capture
    • Video: Change Data Capture (CDC)
    • Quiz: Change Data Capture (CDC)
    • Video: CDC Guarantees
    • Quiz: CDC Guarantees
    • Video: CDC Management
    • Quiz: CDC Management
    • Exercise: Enable Change Data Capture
  • Chapter 5: Consuming Events
    • Video: Idempotency and Ordering
    • Quiz: Idempotency and Ordering
    • Exercise: Consume the Ride Started Event
  • Chapter 6: Best Practices
    • Video: Deleting Data
    • Quiz: Deleting Data
    • Video: Understanding Latency
    • Quiz: Understanding Latency
    • Exercise: Publish the Ride Ended Event
  • Chapter 7: Wrap Up
    • Final Exam
    • Video: Conclusion

Course Staff

Wade Waldron
Wade Waldron
Senior Staff Curriculum Developer

Wade has been a Software Developer since 2005. He has worked on video games, backend microservices, ETL Pipelines, IoT systems and more.

He is an advocate for Test-Driven Development, Domain-Driven Design, Microservice Architectures, and Reactive Systems.