https://github.com/cockroachlabs-field/training-modules
Code samples for the CockroachDB Spring Boot training program.
https://github.com/cockroachlabs-field/training-modules
inbox-pattern outbox-pattern spring-boot spring-data-jpa spring-retry
Last synced: 6 months ago
JSON representation
Code samples for the CockroachDB Spring Boot training program.
- Host: GitHub
- URL: https://github.com/cockroachlabs-field/training-modules
- Owner: cockroachlabs-field
- License: mit
- Created: 2025-02-23T12:13:57.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-02-25T15:49:26.000Z (11 months ago)
- Last Synced: 2025-02-25T16:36:08.424Z (11 months ago)
- Topics: inbox-pattern, outbox-pattern, spring-boot, spring-data-jpa, spring-retry
- Language: Java
- Homepage:
- Size: 81.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
* [About](#about)
* [Modules](#modules)
* [Compatibility](#compatibility)
* [Setup](#setup)
* [Prerequisites](#prerequisites)
* [Install the JDK](#install-the-jdk)
* [Database Setup](#database-setup)
* [Building](#building)
* [Clone the project](#clone-the-project)
* [Build the artifact](#build-the-artifact)
* [Running](#running)
* [Terms of Use](#terms-of-use)
# About

Spring Boot code samples referenced from the
[Java Developer Training]([Spring](https://docs.google.com/presentation/d/1-uUnbs9TPBW-ISPGW4D6ukms5Kogelh9vK-2QOGLt_k/edit?usp=sharing))
presentation deck.
# Modules
- [Chapter 1 :: Transactions](ch1-transactions/README.md)
- [Chapter 2 :: Contention](ch2-contention/README.md)
- [Chapter 3 :: Performance](ch3-performance/README.md)
- [Chapter 4 :: Patterns](ch4-patterns/README.md)
- [Common](common/README.md)
- [Domain](domain/README.md)
# Compatibility
- MacOS
- Linux
- JDK 21+ (LTS)
- CockroachDB v23+
# Setup
Things you need to build and run the modules locally.
## Prerequisites
- Java 21+ JDK
- https://openjdk.org/projects/jdk/21/
- https://www.oracle.com/java/technologies/downloads/#java21
- Git
- https://git-scm.com/downloads/mac
## Install the JDK
MacOS (using sdkman):
curl -s "https://get.sdkman.io" | bash
sdk list java
sdk install java 21.0 (use TAB to pick edition)
Ubuntu:
sudo apt-get install openjdk-21-jdk
## Database Setup
See [start a local cluster](https://www.cockroachlabs.com/docs/v24.2/start-a-local-cluster)
for setup instructions. You can also use CockroachDB Cloud (basic, standard or advanced).
Then create the database, for an insecure cluster:
cockroach sql --insecure -e "create database training_modules"
alternatively, for a secure cluster:
cockroach sql --certs-dir=certs -e "CREATE DATABASE training_modules; ALTER ROLE root WITH PASSWORD 'cockroach'"
An [enterprise license](https://www.cockroachlabs.com/docs/stable/licensing-faqs.html#obtain-a-license) is needed for some of the chapters that
use enterprise features like follower reads and CDC.
## Building
### Clone the project
git clone git@github.com:cockroachlabs-field/training-modules.git && cd training-modules
### Build the artifact
chmod +x mvnw
./mvnw clean install
# Running
Pick the training chapter you want to run the tests in, for example chapter 1.
cd ch1-transactions
Then run the test starter script which will present a menu of options:
./run-test.sh
If you need to connect to a CockroachCloud cluster or non-local cluster, you can edit the
`./run-server.sh` file accordingly.
# Terms of Use
Use of this project is entirely at your own risk and Cockroach Labs makes no guarantees or warranties about its operation.
See [MIT](LICENSE.txt) for terms and conditions.
---
That is all, carry on!