Skip to content

Commit

Permalink
Add more details about exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
MicahCarrick committed Apr 17, 2024
1 parent 4e04710 commit ff50bc0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,23 @@ Node unavailable errors: 0
Other errors: 0
Connections opened: 1524
Connections closed: 1428
```

In a real-world scenario, the exception handler for the `MAX_ERROR_RATE` would be able handle the back pressure according to the use case. For example, if the application is still within SLA and/or there isn't an end-user waiting on a response, the failed operations can be queued for a retry later when the network stabilizes.

```java
public void onFailure(AerospikeException e) {

switch (e.getResultCode()) {
// ...
case ResultCode.MAX_ERROR_RATE:
// Exceeded max number of errors per tend interval (~1s)
// The operation can be queued for retry with something like
// like an exponential backoff, captured in a dead letter
// queue, etc.
break;
// ...
}
}

```

0 comments on commit ff50bc0

Please sign in to comment.