Skip to content

Commit

Permalink
Add updated file
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-wong committed Feb 19, 2024
1 parent bca4e99 commit bf9c43f
Show file tree
Hide file tree
Showing 16 changed files with 90 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repositories {
}

dependencies {
implementation 'com.scalar-labs:scalardb:3.9.1'
implementation 'com.scalar-labs:scalardb:3.9.0'
implementation 'info.picocli:picocli:4.7.1'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ repositories {
}

dependencies {
implementation 'com.scalar-labs:scalardb-sql-jdbc:3.9.1'
implementation 'com.scalar-labs:scalardb-sql-direct-mode:3.9.1'
implementation 'com.scalar-labs:scalardb-sql-jdbc:3.9.0'
implementation 'com.scalar-labs:scalardb-sql-direct-mode:3.9.0'
implementation 'info.picocli:picocli:4.7.1'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This tutorial describes how to create a sample Spring Boot application by using

In addition, you need access to the [ScalarDB SQL GitHub repository](https://github.com/scalar-labs/scalardb-sql) and [Packages in ScalarDB SQL repository](https://github.com/orgs/scalar-labs/packages?repo_name=scalardb-sql).
These repositories are available only to users with a commercial license and permission.
To get a license and permission, please [contact us](https://scalar-labs.com/contact_us/).
To get a license and permission, please [contact us](https://www.scalar-labs.com/contact/).

You also need the `gpr.user` property for your GitHub username and the `gpr.key` property for your personal access token.
You must either add these properties in `~/.gradle/gradle.properties` or specify the properties by using the `-P` option when running the `./gradlew` command as follows:
Expand Down Expand Up @@ -136,6 +136,20 @@ For details, please see [Configuration - Multi-storage Transactions](https://git

## Setup

### Clone the ScalarDB samples repository

Open Terminal, then clone the ScalarDB samples repository by running the following command:

```shell
$ git clone https://github.com/scalar-labs/scalardb-samples
```

Then, go to the directory with this sample by running the following command:

```shell
$ cd scalardb-samples/spring-data-multi-storage-transaction-sample
```

### Start Cassandra and MySQL

To start Cassandra and MySQL, you need to run the following `docker-compose` command:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ repositories {
}

dependencies {
implementation "com.scalar-labs:scalardb-sql-spring-data:3.9.1"
implementation "com.scalar-labs:scalardb-sql-direct-mode:3.9.1"
implementation "com.scalar-labs:scalardb-sql-spring-data:3.9.0"
implementation "com.scalar-labs:scalardb-sql-direct-mode:3.9.0"
// This includes dependencies to `spring-boot-starter` and `picocli`
implementation "info.picocli:picocli-spring-boot-starter:4.7.1"
// For retry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

@EnableScalarDbRepositories
@Service
@Retryable(
include = TransientDataAccessException.class,
maxAttempts = 8,
backoff = @Backoff(delay = 1000, maxDelay = 8000, multiplier = 2))
public class SampleService {
private final ObjectMapper objectMapper = new ObjectMapper();

Expand Down Expand Up @@ -56,10 +60,6 @@ private String asJson(Object obj) {
}
}

@Retryable(
include = TransientDataAccessException.class,
maxAttempts = 8,
backoff = @Backoff(delay = 1000, maxDelay = 8000, multiplier = 2))
@Transactional
public String getCustomerInfo(int customerId) {
try {
Expand All @@ -71,10 +71,6 @@ public String getCustomerInfo(int customerId) {
}
}

@Retryable(
include = TransientDataAccessException.class,
maxAttempts = 8,
backoff = @Backoff(delay = 1000, maxDelay = 8000, multiplier = 2))
@Transactional
public String placeOrder(int customerId, List<ItemOrder> itemOrders) {
String orderId = UUID.randomUUID().toString();
Expand Down Expand Up @@ -138,21 +134,13 @@ private OrderDetail getOrderDetail(String orderId) {
orderId, customerId, customer.name, order.timestamp, statementDetails, total.get());
}

@Retryable(
include = TransientDataAccessException.class,
maxAttempts = 8,
backoff = @Backoff(delay = 1000, maxDelay = 8000, multiplier = 2))
@Transactional
public String getOrderByOrderId(String orderId) {
// Get an order JSON for the specified order ID.
// Return the order info as a JSON format.
return asJson(getOrderDetail(orderId));
}

@Retryable(
include = TransientDataAccessException.class,
maxAttempts = 8,
backoff = @Backoff(delay = 1000, maxDelay = 8000, multiplier = 2))
@Transactional
public String getOrdersByCustomerId(int customerId) {
// Retrieve the order info for the customer ID from the orders table.
Expand All @@ -163,10 +151,6 @@ public String getOrdersByCustomerId(int customerId) {
.collect(Collectors.toList()));
}

@Retryable(
include = TransientDataAccessException.class,
maxAttempts = 8,
backoff = @Backoff(delay = 1000, maxDelay = 8000, multiplier = 2))
@Transactional
public void repayment(int customerId, int amount) {
Customer customer = customerRepository.getById(customerId);
Expand Down
16 changes: 15 additions & 1 deletion docs/3.12/scalardb-samples/spring-data-sample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This tutorial describes how to create a sample Spring Boot application by using

In addition, you need access to the [ScalarDB SQL GitHub repository](https://github.com/scalar-labs/scalardb-sql) and [Packages in ScalarDB SQL repository](https://github.com/orgs/scalar-labs/packages?repo_name=scalardb-sql).
These repositories are available only to users with a commercial license and permission.
To get a license and permission, please [contact us](https://scalar-labs.com/contact_us/).
To get a license and permission, please [contact us](https://www.scalar-labs.com/contact/).

You also need the `gpr.user` property for your GitHub username and the `gpr.key` property for your personal access token.
You must either add these properties in `~/.gradle/gradle.properties` or specify the properties by using the `-P` option when running the `./gradlew` command as follows:
Expand Down Expand Up @@ -118,6 +118,20 @@ Since this sample application uses Cassandra, as shown above, you need to config

## Setup

### Clone the ScalarDB samples repository

Open Terminal, then clone the ScalarDB samples repository by running the following command:

```shell
$ git clone https://github.com/scalar-labs/scalardb-samples
```

Then, go to the directory with this sample by running the following command:

```shell
$ cd scalardb-samples/spring-data-sample
```

### Start Cassandra

To start Cassandra, you need to run the following `docker-compose` command:
Expand Down
4 changes: 2 additions & 2 deletions docs/3.12/scalardb-samples/spring-data-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ repositories {
}

dependencies {
implementation "com.scalar-labs:scalardb-sql-spring-data:3.9.1"
implementation "com.scalar-labs:scalardb-sql-direct-mode:3.9.1"
implementation "com.scalar-labs:scalardb-sql-spring-data:3.9.0"
implementation "com.scalar-labs:scalardb-sql-direct-mode:3.9.0"
// This includes dependencies to `spring-boot-starter` and `picocli`
implementation "info.picocli:picocli-spring-boot-starter:4.7.1"
// For retry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

@EnableScalarDbRepositories
@Service
@Retryable(
include = TransientDataAccessException.class,
maxAttempts = 8,
backoff = @Backoff(delay = 1000, maxDelay = 8000, multiplier = 2))
public class SampleService {
private final ObjectMapper objectMapper = new ObjectMapper();

Expand Down Expand Up @@ -56,10 +60,6 @@ private String asJson(Object obj) {
}
}

@Retryable(
include = TransientDataAccessException.class,
maxAttempts = 8,
backoff = @Backoff(delay = 1000, maxDelay = 8000, multiplier = 2))
@Transactional
public String getCustomerInfo(int customerId) {
try {
Expand All @@ -71,10 +71,6 @@ public String getCustomerInfo(int customerId) {
}
}

@Retryable(
include = TransientDataAccessException.class,
maxAttempts = 8,
backoff = @Backoff(delay = 1000, maxDelay = 8000, multiplier = 2))
@Transactional
public String placeOrder(int customerId, List<ItemOrder> itemOrders) {
String orderId = UUID.randomUUID().toString();
Expand Down Expand Up @@ -138,21 +134,13 @@ private OrderDetail getOrderDetail(String orderId) {
orderId, customerId, customer.name, order.timestamp, statementDetails, total.get());
}

@Retryable(
include = TransientDataAccessException.class,
maxAttempts = 8,
backoff = @Backoff(delay = 1000, maxDelay = 8000, multiplier = 2))
@Transactional
public String getOrderByOrderId(String orderId) {
// Get an order JSON for the specified order ID.
// Return the order info as a JSON format.
return asJson(getOrderDetail(orderId));
}

@Retryable(
include = TransientDataAccessException.class,
maxAttempts = 8,
backoff = @Backoff(delay = 1000, maxDelay = 8000, multiplier = 2))
@Transactional
public String getOrdersByCustomerId(int customerId) {
// Retrieve the order info for the customer ID from the orders table.
Expand All @@ -163,10 +151,6 @@ public String getOrdersByCustomerId(int customerId) {
.collect(Collectors.toList()));
}

@Retryable(
include = TransientDataAccessException.class,
maxAttempts = 8,
backoff = @Backoff(delay = 1000, maxDelay = 8000, multiplier = 2))
@Transactional
public void repayment(int customerId, int amount) {
Customer customer = customerRepository.getById(customerId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repositories {
}

dependencies {
implementation 'com.scalar-labs:scalardb:3.9.1'
implementation 'com.scalar-labs:scalardb:3.9.0'
implementation 'info.picocli:picocli:4.7.1'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ repositories {
}

dependencies {
implementation 'com.scalar-labs:scalardb-sql-jdbc:3.9.1'
implementation 'com.scalar-labs:scalardb-sql-direct-mode:3.9.1'
implementation 'com.scalar-labs:scalardb-sql-jdbc:3.9.0'
implementation 'com.scalar-labs:scalardb-sql-direct-mode:3.9.0'
implementation 'info.picocli:picocli:4.7.1'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This tutorial describes how to create a sample Spring Boot application by using

In addition, you need access to the [ScalarDB SQL GitHub repository](https://github.com/scalar-labs/scalardb-sql) and [Packages in ScalarDB SQL repository](https://github.com/orgs/scalar-labs/packages?repo_name=scalardb-sql).
These repositories are available only to users with a commercial license and permission.
To get a license and permission, please [contact us](https://scalar-labs.com/contact_us/).
To get a license and permission, please [contact us](https://www.scalar-labs.com/contact/).

You also need the `gpr.user` property for your GitHub username and the `gpr.key` property for your personal access token.
You must either add these properties in `~/.gradle/gradle.properties` or specify the properties by using the `-P` option when running the `./gradlew` command as follows:
Expand Down Expand Up @@ -136,6 +136,20 @@ For details, please see [Configuration - Multi-storage Transactions](https://git

## Setup

### Clone the ScalarDB samples repository

Open Terminal, then clone the ScalarDB samples repository by running the following command:

```shell
$ git clone https://github.com/scalar-labs/scalardb-samples
```

Then, go to the directory with this sample by running the following command:

```shell
$ cd scalardb-samples/spring-data-multi-storage-transaction-sample
```

### Start Cassandra and MySQL

To start Cassandra and MySQL, you need to run the following `docker-compose` command:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ repositories {
}

dependencies {
implementation "com.scalar-labs:scalardb-sql-spring-data:3.9.1"
implementation "com.scalar-labs:scalardb-sql-direct-mode:3.9.1"
implementation "com.scalar-labs:scalardb-sql-spring-data:3.9.0"
implementation "com.scalar-labs:scalardb-sql-direct-mode:3.9.0"
// This includes dependencies to `spring-boot-starter` and `picocli`
implementation "info.picocli:picocli-spring-boot-starter:4.7.1"
// For retry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

@EnableScalarDbRepositories
@Service
@Retryable(
include = TransientDataAccessException.class,
maxAttempts = 8,
backoff = @Backoff(delay = 1000, maxDelay = 8000, multiplier = 2))
public class SampleService {
private final ObjectMapper objectMapper = new ObjectMapper();

Expand Down Expand Up @@ -56,10 +60,6 @@ private String asJson(Object obj) {
}
}

@Retryable(
include = TransientDataAccessException.class,
maxAttempts = 8,
backoff = @Backoff(delay = 1000, maxDelay = 8000, multiplier = 2))
@Transactional
public String getCustomerInfo(int customerId) {
try {
Expand All @@ -71,10 +71,6 @@ public String getCustomerInfo(int customerId) {
}
}

@Retryable(
include = TransientDataAccessException.class,
maxAttempts = 8,
backoff = @Backoff(delay = 1000, maxDelay = 8000, multiplier = 2))
@Transactional
public String placeOrder(int customerId, List<ItemOrder> itemOrders) {
String orderId = UUID.randomUUID().toString();
Expand Down Expand Up @@ -138,21 +134,13 @@ private OrderDetail getOrderDetail(String orderId) {
orderId, customerId, customer.name, order.timestamp, statementDetails, total.get());
}

@Retryable(
include = TransientDataAccessException.class,
maxAttempts = 8,
backoff = @Backoff(delay = 1000, maxDelay = 8000, multiplier = 2))
@Transactional
public String getOrderByOrderId(String orderId) {
// Get an order JSON for the specified order ID.
// Return the order info as a JSON format.
return asJson(getOrderDetail(orderId));
}

@Retryable(
include = TransientDataAccessException.class,
maxAttempts = 8,
backoff = @Backoff(delay = 1000, maxDelay = 8000, multiplier = 2))
@Transactional
public String getOrdersByCustomerId(int customerId) {
// Retrieve the order info for the customer ID from the orders table.
Expand All @@ -163,10 +151,6 @@ public String getOrdersByCustomerId(int customerId) {
.collect(Collectors.toList()));
}

@Retryable(
include = TransientDataAccessException.class,
maxAttempts = 8,
backoff = @Backoff(delay = 1000, maxDelay = 8000, multiplier = 2))
@Transactional
public void repayment(int customerId, int amount) {
Customer customer = customerRepository.getById(customerId);
Expand Down
16 changes: 15 additions & 1 deletion docs/latest/scalardb-samples/spring-data-sample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This tutorial describes how to create a sample Spring Boot application by using

In addition, you need access to the [ScalarDB SQL GitHub repository](https://github.com/scalar-labs/scalardb-sql) and [Packages in ScalarDB SQL repository](https://github.com/orgs/scalar-labs/packages?repo_name=scalardb-sql).
These repositories are available only to users with a commercial license and permission.
To get a license and permission, please [contact us](https://scalar-labs.com/contact_us/).
To get a license and permission, please [contact us](https://www.scalar-labs.com/contact/).

You also need the `gpr.user` property for your GitHub username and the `gpr.key` property for your personal access token.
You must either add these properties in `~/.gradle/gradle.properties` or specify the properties by using the `-P` option when running the `./gradlew` command as follows:
Expand Down Expand Up @@ -118,6 +118,20 @@ Since this sample application uses Cassandra, as shown above, you need to config

## Setup

### Clone the ScalarDB samples repository

Open Terminal, then clone the ScalarDB samples repository by running the following command:

```shell
$ git clone https://github.com/scalar-labs/scalardb-samples
```

Then, go to the directory with this sample by running the following command:

```shell
$ cd scalardb-samples/spring-data-sample
```

### Start Cassandra

To start Cassandra, you need to run the following `docker-compose` command:
Expand Down
Loading

0 comments on commit bf9c43f

Please sign in to comment.