From b113607980896bac793d8b85c6b80b460eec8ec1 Mon Sep 17 00:00:00 2001 From: Sonu Kumar Date: Tue, 9 Jul 2024 09:17:58 +0530 Subject: [PATCH] update doc and handling --- docs/.ruby-version | 1 + docs/Gemfile.lock | 4 +++- docs/_includes/footer_custom.html | 2 +- docs/configuration/configuration.md | 7 ------- docs/configuration/retry-and-backoff.md | 6 ++++-- docs/dashboard.md | 4 ++++ docs/index.md | 3 ++- .../rqueue/listener/PostProcessingHandler.java | 17 +---------------- .../sonus21/rqueue/listener/RqueueExecutor.java | 5 ----- .../rqueue/models/enums/ExecutionStatus.java | 1 - .../utils/backoff/TaskExecutionBackOff.java | 6 ------ 11 files changed, 16 insertions(+), 40 deletions(-) create mode 100644 docs/.ruby-version diff --git a/docs/.ruby-version b/docs/.ruby-version new file mode 100644 index 00000000..fd2a0186 --- /dev/null +++ b/docs/.ruby-version @@ -0,0 +1 @@ +3.1.0 diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 4962bad0..5746787a 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -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) @@ -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) @@ -92,6 +93,7 @@ GEM PLATFORMS arm64-darwin-21 + arm64-darwin-23 x86_64-linux DEPENDENCIES diff --git a/docs/_includes/footer_custom.html b/docs/_includes/footer_custom.html index ba0e680d..78d1869e 100644 --- a/docs/_includes/footer_custom.html +++ b/docs/_includes/footer_custom.html @@ -1 +1 @@ -Copyright © 2019-{{ "now" | date: "%Y" }} Sonu Kumar. Build on {{"now"}} Distributed by an Apache 2.0 license. +Copyright © 2019-{{ "now" | date: "%Y" }} Sonu Kumar. Distributed by an Apache 2.0 license. Build on {{ "now" | date:"%Y-%m-%d %H:%M" }} diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index 7b47cc3e..3cb03d22 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -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 diff --git a/docs/configuration/retry-and-backoff.md b/docs/configuration/retry-and-backoff.md index a2fad2b7..376058a4 100644 --- a/docs/configuration/retry-and-backoff.md +++ b/docs/configuration/retry-and-backoff.md @@ -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{ @@ -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. diff --git a/docs/dashboard.md b/docs/dashboard.md index b845c6bd..11178e19 100644 --- a/docs/dashboard.md +++ b/docs/dashboard.md @@ -84,17 +84,21 @@ prefix: [http://localhost:8080/my-application/rqueue](http://localhost:8080/my-a ### Dashboard Screenshots #### Latency Graph +
[![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 +
[![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 +
[![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 +
[![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) diff --git a/docs/index.md b/docs/index.md index 45e64c8c..3d153c11 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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. @@ -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 diff --git a/rqueue-core/src/main/java/com/github/sonus21/rqueue/listener/PostProcessingHandler.java b/rqueue-core/src/main/java/com/github/sonus21/rqueue/listener/PostProcessingHandler.java index 38bb5cb8..07dad13b 100644 --- a/rqueue-core/src/main/java/com/github/sonus21/rqueue/listener/PostProcessingHandler.java +++ b/rqueue-core/src/main/java/com/github/sonus21/rqueue/listener/PostProcessingHandler.java @@ -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; @@ -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) { @@ -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); } @@ -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); - } } diff --git a/rqueue-core/src/main/java/com/github/sonus21/rqueue/listener/RqueueExecutor.java b/rqueue-core/src/main/java/com/github/sonus21/rqueue/listener/RqueueExecutor.java index 787dbcb6..0613a677 100644 --- a/rqueue-core/src/main/java/com/github/sonus21/rqueue/listener/RqueueExecutor.java +++ b/rqueue-core/src/main/java/com/github/sonus21/rqueue/listener/RqueueExecutor.java @@ -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; diff --git a/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/enums/ExecutionStatus.java b/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/enums/ExecutionStatus.java index 90a4e6f8..bb9f5ef6 100644 --- a/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/enums/ExecutionStatus.java +++ b/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/enums/ExecutionStatus.java @@ -22,7 +22,6 @@ public enum ExecutionStatus { THROTTLED, DELETED, FAILED, - FAILED_IGNORED, IGNORED, OLD_MESSAGE, QUEUE_INACTIVE, diff --git a/rqueue-core/src/main/java/com/github/sonus21/rqueue/utils/backoff/TaskExecutionBackOff.java b/rqueue-core/src/main/java/com/github/sonus21/rqueue/utils/backoff/TaskExecutionBackOff.java index 4371ba34..8b76de3f 100644 --- a/rqueue-core/src/main/java/com/github/sonus21/rqueue/utils/backoff/TaskExecutionBackOff.java +++ b/rqueue-core/src/main/java/com/github/sonus21/rqueue/utils/backoff/TaskExecutionBackOff.java @@ -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. *

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

Return {@value #DO_NOT_RETRY} to indicate that no further retry should be made

*

Return {@value #STOP} to indicate message should be moved to DLQ if DLQ is set

* * @param message message that's fetched