, 2021 ·


Discover Distributed SQL with CockroachDB and Spring

(90 min)

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 nondistributed 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 workshop, you’ll learn about the Outbox pattern, which can be used in event-driven systems to ensure that your events are always consistent with your state. You’ll use the Spring Data JPA framework along with Spring Boot to emit events from one microservice so that they can be consumed in another. You’ll leverage specific features in CockroachDB to make this not only possible, but convenient.

A team of architects and developers from Cockroach Labs will guide you through the following:

  • Setting up a simple CockroachDB instance with access to commercial features
  • Adding an outbox table to an existing microservice's schema
  • Performing a transactional update to the outbox table
  • Using CockroachDB's Change Data Capture to push events from the Outbox table to a Kafka cluster
  • Consuming the events from Kafka in order to update the state of a second microservice



By signing up for this workshop, you consent to have your information shared with Cockroach Labs.