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 - Fee…
…dback improvements (#30617) This pull request includes several changes to the job queue management system, focusing on improving the handling of job cancellation requests and updating exception handling. The key changes include the introduction of a new event for job cancellation requests, modifications to exception types for consistency, and enhancements to job state management. ### Improvements to job cancellation handling: * Added a new `JobCancelRequestEvent` class to represent job cancellation requests and handle them appropriately (`dotCMS/src/main/java/com/dotcms/jobs/business/api/events/JobCancelRequestEvent.java`). * Introduced a method `onCancelRequestJob` to handle job cancellation requests and updated the `cancelJob` method to use this new method (`dotCMS/src/main/java/com/dotcms/jobs/business/api/JobQueueManagerAPIImpl.java`). [[1]](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561R180-R184) [[2]](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561R862-R909) ### Exception handling improvements: * Replaced `JobQueueDataException` with `DotDataException` in various methods to standardize exception handling (`dotCMS/src/main/java/com/dotcms/jobs/business/api/JobQueueManagerAPI.java`). [[1]](diffhunk://#diff-97639376a50922f533c812eb8848f70e1913df8f14f0fb5bb582243f5660e465L10) [[2]](diffhunk://#diff-97639376a50922f533c812eb8848f70e1913df8f14f0fb5bb582243f5660e465L97-R99) [[3]](diffhunk://#diff-97639376a50922f533c812eb8848f70e1913df8f14f0fb5bb582243f5660e465L118-R149) * Updated exception handling in `getActiveJobs`, `getCompletedJobs`, `getCanceledJobs`, and `getFailedJobs` methods to throw `DotDataException` instead of `JobQueueDataException` (`dotCMS/src/main/java/com/dotcms/jobs/business/api/JobQueueManagerAPIImpl.java`). [[1]](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561L307-R323) [[2]](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561L327-R434) ### Job state management: * Added a method `getJobState` to fetch the state of a job and ensure the latest state is used during job progress updates (`dotCMS/src/main/java/com/dotcms/jobs/business/api/JobQueueManagerAPIImpl.java`). * Enhanced the `handleJobCompletion` method to check if a job has been in a canceling state and update its status accordingly (`dotCMS/src/main/java/com/dotcms/jobs/business/api/JobQueueManagerAPIImpl.java`). ### Code cleanup and imports: * Removed unused import `JobQueueDataException` and added necessary imports for new event handling (`dotCMS/src/main/java/com/dotcms/jobs/business/api/JobQueueManagerAPI.java`). * Added imports for new event handling and exception classes (`dotCMS/src/main/java/com/dotcms/jobs/business/api/JobQueueManagerAPIImpl.java`). [[1]](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561R3-R8) [[2]](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561R20) [[3]](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561R37-R44)
- Loading branch information