Skip to content

Commit

Permalink
Merge branch 'master' into jdempotent-couchbase-starter
Browse files Browse the repository at this point in the history
  • Loading branch information
memojja authored Jul 16, 2021
2 parents 525215a + 9528082 commit 4679c0a
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

# Goal of this Jdempotent-spring-boot-starter

Make your listener or etc idempotent easily
Make your endpoints idempotent easily

# Usage

1 - First of all you need add dependency to pom.xml
1 - First of all, you need to add a dependency to pom.xml

For Redis:
```xml
Expand All @@ -31,7 +31,7 @@ For Couchbase
</dependency>
```

2 - You should add `@IdempotentResource` annotation to that you want to make idempotent resource, listener etc.
2 - You should add `@IdempotentResource` annotation to the method that you want to make idempotent resource, listener etc.

```java
@IdempotentResource(cachePrefix = "WelcomingListener")
Expand All @@ -52,7 +52,7 @@ public void consumeMessage(@IdempotentRequestPayload String emailAdress) {
}
}
```
3 - If you want custom error case, you should implement `ErrorConditionalCallback` like a following example
3 - If you want to handle a custom error case, you need to implement `ErrorConditionalCallback` like the following example:

```java
@Component
Expand All @@ -70,8 +70,9 @@ public class AspectConditionalCallback implements ErrorConditionalCallback {
}
```

4 - Now you need to decide your datasource. That maybe inmemory,redis or couchbase.
Let's make redis configuration.
4 - Let's make the configuration:

For redis configuration:

```yaml
jdempotent:
Expand All @@ -91,7 +92,8 @@ jdempotent:
expireTimeoutHour: 3
```
Let's make couchbase configuration.
For couchbase configuration:
```yaml
jdempotent:
enable: true
Expand All @@ -108,9 +110,10 @@ jdempotent:
kv-timeout: 3000
```
Please note that you can disable Jdempotent easily if you need to.
For example, assume that you don't have a circut breaker and your Redis is down.
In that case, you can disable Jdempotent with the following configuration:
Also you can disable jdempotent any time for example you don't have circut breaker but your redis down etc.
You can wish disable jdempotent with following configuration.
```yaml
enable: false
Expand All @@ -124,7 +127,7 @@ You can wish disable jdempotent with following configuration.

### Performance

As it is shown in the following image, the most cpu consuming part of jdempotent is getting a redis connection so we don't need to worry performance related issues.
As it is shown in the following image, the most cpu consuming part of Jdempotent is getting a Redis connection so we don't need to worry performance related issues.

<p align="center">
<img src="examples/cpu-profiling.png">
Expand Down

0 comments on commit 4679c0a

Please sign in to comment.