Skip to content

Commit

Permalink
update doc and handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonu Kumar committed Jul 9, 2024
1 parent 43f8d7c commit b113607
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 40 deletions.
1 change: 1 addition & 0 deletions docs/.ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.0
4 changes: 3 additions & 1 deletion docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ GEM
forwardable-extended (2.6.0)
gemoji (3.0.1)
google-protobuf (3.21.12)
google-protobuf (3.21.12-x86_64-linux)
http_parser.rb (0.8.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -82,7 +83,7 @@ GEM
safe_yaml (1.0.5)
sass-embedded (1.58.0-arm64-darwin)
google-protobuf (~> 3.21)
sass-embedded (1.58.0-x86_64-linux-gnu)
sass-embedded (1.58.0-x86_64-linux)
google-protobuf (~> 3.21)
strscan (3.1.0)
terminal-table (3.0.2)
Expand All @@ -92,6 +93,7 @@ GEM

PLATFORMS
arm64-darwin-21
arm64-darwin-23
x86_64-linux

DEPENDENCIES
Expand Down
2 changes: 1 addition & 1 deletion docs/_includes/footer_custom.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Copyright &copy; 2019-{{ "now" | date: "%Y" }} Sonu Kumar. Build on {{"now"}} Distributed by an <a href="https://github.com/sonus21/rqueue/tree/main/LICENSE">Apache 2.0 license.</a>
Copyright &copy; 2019-{{ "now" | date: "%Y" }} Sonu Kumar. Distributed by an <a href="https://github.com/sonus21/rqueue/tree/main/LICENSE">Apache 2.0 license.</a> Build on {{ "now" | date:"%Y-%m-%d %H:%M" }}
7 changes: 0 additions & 7 deletions docs/configuration/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ configuration or directly in the code.

{: .fs-6 .fw-300 }

## Table of contents

{: .no_toc .text-delta }

1. TOC
{:toc}

---
Apart from the basic configuration, Rqueue can be heavily customized, such as adjusting the number
of tasks executed concurrently. Additional configurations can be provided using
Expand Down
6 changes: 4 additions & 2 deletions docs/configuration/retry-and-backoff.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ the `SimpleRqueueListenerContainerFactory`. The default back-off time is 5 secon

In scenarios where you don't want Rqueue to retry failures, you can handle this in two ways:

1. **Using `RqueueListener` Annotation**: Add exceptions to the `doNotRetry` list within
- **Using `RqueueListener` Annotation**: Add exceptions to the `doNotRetry` list within
the `RqueueListener` annotation. This instructs Rqueue not to retry for specific exceptions.

```java

public class MessageListener{
Expand All @@ -30,7 +31,8 @@ public class MessageListener{

}
```
2. **Returning `-2` from Execution Backoff Method**: Alternatively, you can return `-2` from the

- **Returning `-1` from Execution Backoff Method**: Alternatively, you can return `-1` from the
execution backoff method. This signals Rqueue to stop any further retry attempts for the failed
message.

Expand Down
4 changes: 4 additions & 0 deletions docs/dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,21 @@ prefix: [http://localhost:8080/my-application/rqueue](http://localhost:8080/my-a
### Dashboard Screenshots

#### Latency Graph
<br/>

[![Latency Graph](https://raw.githubusercontent.com/sonus21/rqueue/master/docs/static/stats-graph.png)](https://raw.githubusercontent.com/sonus21/rqueue/master/docs/static/stats-graph.png)

#### Queue Statistics
<br/>

[![Queue Statistics](https://raw.githubusercontent.com/sonus21/rqueue/master/docs/static/queues.png)](https://raw.githubusercontent.com/sonus21/rqueue/master/docs/static/queues.png)

#### Tasks Waiting for Execution
<br/>

[![Tasks Waiting for Execution](https://raw.githubusercontent.com/sonus21/rqueue/master/docs/static/queue-explore.png)](https://raw.githubusercontent.com/sonus21/rqueue/master/docs/static/queue-explore.png)

#### Running Tasks
<br/>

[![Running Tasks](https://raw.githubusercontent.com/sonus21/rqueue/master/docs/static/running-tasks.png)](https://raw.githubusercontent.com/sonus21/rqueue/master/docs/static/running-tasks.png)
3 changes: 2 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ frameworks.
* **Queue Priority**: Supports both group-level and sub-queue level priorities.
* **Long Execution Jobs**: Check-in mechanism for long-running jobs.
* **Execution Backoff**: Supports exponential and fixed backoff strategies.
* **Do not retry**: Supports do not retry exceptions.
* **Do not retry**: Supports do not retry strategy.
* **Middleware**: Allows integration of middleware to intercept messages before processing.
* **Callbacks**: Supports callbacks for handling dead letter queues and discarding messages.
* **Events**: Provides bootstrap and task execution events.
Expand Down Expand Up @@ -304,6 +304,7 @@ the [GitHub repository][Rqueue repo] or contact the maintainers directly.
{: .fs-5 }

Rqueue is licensed under the Apache License 2.0. See the [LICENSE](https://github.com/sonus21/rqueue/blob/master/LICENSE) file for more details.

[Rqueue Docs]: https://github.com/sonus21/rqueue/wiki
[Boot Maven Central]: https://search.maven.org/artifact/com.github.sonus21/rqueue-spring-boot-starter
[Maven Central]: https://search.maven.org/artifact/com.github.sonus21/rqueue-spring
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ void handle(JobImpl job,
case IGNORED:
handleIgnoredMessage(job, failureCount);
break;
case FAILED_IGNORED:
handleFailedIgnoredMessage(job, failureCount);
break;
case OLD_MESSAGE:
handleOldMessage(job, job.getRqueueMessage());
break;
Expand Down Expand Up @@ -283,7 +280,7 @@ private int getMaxRetryCount(RqueueMessage rqueueMessage, QueueDetail queueDetai

private void handleFailure(JobImpl job, int failureCount, Throwable throwable) {
if (job.getQueueDetail().isDoNotRetryError(throwable)) {
handleFailedIgnoredMessage(job, failureCount);
handleRetryExceededMessage(job, failureCount, throwable);
} else {
int maxRetryCount = getMaxRetryCount(job.getRqueueMessage(), job.getQueueDetail());
if (failureCount < maxRetryCount) {
Expand All @@ -292,8 +289,6 @@ private void handleFailure(JobImpl job, int failureCount, Throwable throwable) {
throwable);
if (delay == TaskExecutionBackOff.STOP) {
handleRetryExceededMessage(job, failureCount, throwable);
} else if (delay == TaskExecutionBackOff.DO_NOT_RETRY) {
handleFailedIgnoredMessage(job, failureCount);
} else {
parkMessageForRetry(job, null, failureCount, delay);
}
Expand All @@ -312,14 +307,4 @@ private void handleIgnoredMessage(JobImpl job, int failureCount) {
job.getQueueDetail().getName());
deleteMessage(job, MessageStatus.IGNORED, failureCount);
}

private void handleFailedIgnoredMessage(JobImpl job, int failureCount) {
log(
Level.DEBUG,
"Message {} failed & ignored, Queue: {}",
null,
job.getRqueueMessage(),
job.getQueueDetail().getName());
deleteMessage(job, MessageStatus.DISCARDED, failureCount);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,10 @@ private boolean shouldRetry(long maxProcessingTime, int retryCount, int failureC
boolean doNoRetry = queueDetail.isDoNotRetryError(error);
// it should not be retried based on the exception list
if (doNoRetry) {
status = ExecutionStatus.FAILED_IGNORED;
return false;
}
// check if this should not be retried based on the backoff
long backOff = postProcessingHandler.backOff(rqueueMessage, userMessage, failureCount, error);
if (backOff == TaskExecutionBackOff.DO_NOT_RETRY) {
status = ExecutionStatus.FAILED_IGNORED;
return false;
}
return backOff != TaskExecutionBackOff.STOP;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public enum ExecutionStatus {
THROTTLED,
DELETED,
FAILED,
FAILED_IGNORED,
IGNORED,
OLD_MESSAGE,
QUEUE_INACTIVE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ public interface TaskExecutionBackOff {
* should not be retried further.
*/
long STOP = -1;
/**
* Return this value, so that it will not retry post-failure, and it won't move to DLQ as well.
*/
long DO_NOT_RETRY = -2;

/**
* Return the number of milliseconds to wait for the same message to be consumed.
* <p>Return {@value #STOP} to indicate that no further enqueue should be made for the message.
Expand All @@ -44,7 +39,6 @@ public interface TaskExecutionBackOff {

/**
* Return the number of milliseconds to wait for the same message to be consumed.
* <p>Return {@value #DO_NOT_RETRY} to indicate that no further retry should be made</p>
* <p>Return {@value #STOP} to indicate message should be moved to DLQ if DLQ is set</p>
*
* @param message message that's fetched
Expand Down

0 comments on commit b113607

Please sign in to comment.