-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat (Core): Migrate import contentlets action to job processor (#30432)
This pull request introduces a new processor `ImportContentletsProcessor`, which replicates the functionality we have in the `ImportContentletsAction` but using the new jobs infrastructureseveral, also enhancements and refactoring to the `JobQueueManagerAPI` and related classes. The key changes include adding new methods for retrieving job lists, integrating a retry policy processor, and improving the real-time job monitoring system. ### Enhancements to Job Retrieval: * Added new methods to `JobQueueManagerAPI` for retrieving lists of active, completed, canceled, and failed jobs with pagination support. (`dotCMS/src/main/java/com/dotcms/jobs/business/api/JobQueueManagerAPI.java`) [[1]](diffhunk://#diff-97639376a50922f533c812eb8848f70e1913df8f14f0fb5bb582243f5660e465R90-R101) [[2]](diffhunk://#diff-97639376a50922f533c812eb8848f70e1913df8f14f0fb5bb582243f5660e465L100-R148) * Implemented these methods in `JobQueueManagerAPIImpl` to interact with the job queue and handle exceptions. (`dotCMS/src/main/java/com/dotcms/jobs/business/api/JobQueueManagerAPIImpl.java`) [[1]](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561R303-R313) [[2]](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561L304-R364) ### Retry Policy Integration: * Introduced `RetryPolicyProcessor` to process retry policies for job processors and integrated it into `JobQueueManagerAPIImpl`. (`dotCMS/src/main/java/com/dotcms/jobs/business/api/JobQueueManagerAPIImpl.java`) [[1]](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561R111) [[2]](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561R251-R256) * Modified the constructor of `JobQueueManagerAPIImpl` to include the `RetryPolicyProcessor` parameter. (`dotCMS/src/main/java/com/dotcms/jobs/business/api/JobQueueManagerAPIImpl.java`) [[1]](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561L144-R151) [[2]](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561R160-R161) [[3]](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561L166) ### Real-Time Job Monitoring: * Enhanced `RealTimeJobMonitor` to support filtered watching through predicates, allowing clients to receive specific job updates. Added detailed documentation and examples for usage. (`dotCMS/src/main/java/com/dotcms/jobs/business/api/events/RealTimeJobMonitor.java`) [[1]](diffhunk://#diff-ff9af41ece416b81fb0f12a7a8a9a8e5fe54ccbb278f4121bb0fce04b149cc36R4-R129) [[2]](diffhunk://#diff-ff9af41ece416b81fb0f12a7a8a9a8e5fe54ccbb278f4121bb0fce04b149cc36L59-R155) * Created `AbstractJobWatcher` to encapsulate a watcher and its filter predicate, supporting the new monitoring functionality. (`dotCMS/src/main/java/com/dotcms/jobs/business/api/events/AbstractJobWatcher.java`) ### Code Refactoring: * Simplified method signatures and improved exception handling in `JobQueueManagerAPIImpl`. (`dotCMS/src/main/java/com/dotcms/jobs/business/api/JobQueueManagerAPIImpl.java`) [[1]](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561L685-R736) [[2]](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561R860-R882) * Added missing Javadoc comments and improved existing ones for better clarity and documentation. (`dotCMS/src/main/java/com/dotcms/jobs/business/api/JobQueueManagerAPI.java`) [[1]](diffhunk://#diff-97639376a50922f533c812eb8848f70e1913df8f14f0fb5bb582243f5660e465R64) [[2]](diffhunk://#diff-97639376a50922f533c812eb8848f70e1913df8f14f0fb5bb582243f5660e465R178) These changes collectively improve the robustness, maintainability, and functionality of the job management and monitoring systems in the `dotCMS` project.
- Loading branch information
1 parent
6216748
commit 73623f2
Showing
30 changed files
with
3,134 additions
and
489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
dotCMS/src/main/java/com/dotcms/jobs/business/api/events/AbstractJobWatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.dotcms.jobs.business.api.events; | ||
|
||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
import java.util.function.Consumer; | ||
import java.util.function.Predicate; | ||
import org.immutables.value.Value; | ||
|
||
/** | ||
* Class to hold a watcher and its filter predicate. | ||
*/ | ||
@Value.Style(typeImmutable = "*", typeAbstract = "Abstract*") | ||
@Value.Immutable | ||
@JsonSerialize(as = JobWatcher.class) | ||
@JsonDeserialize(as = JobWatcher.class) | ||
public interface AbstractJobWatcher { | ||
|
||
/** | ||
* Returns a Consumer that performs an operation on a Job instance. | ||
* | ||
* @return a Consumer of Job that defines what to do with a Job instance. | ||
*/ | ||
Consumer<com.dotcms.jobs.business.job.Job> watcher(); | ||
|
||
/** | ||
* Returns a predicate that can be used to filter jobs based on custom criteria. | ||
* | ||
* @return a Predicate object to filter Job instances | ||
*/ | ||
Predicate<com.dotcms.jobs.business.job.Job> filter(); | ||
|
||
} |
Oops, something went wrong.