-
Notifications
You must be signed in to change notification settings - Fork 467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat (Core): PostgresJobQueue Implementation and Job Processing Enhancements #30175
Merged
nollymar
merged 35 commits into
master
from
issue-29479-Create-a-default-JobQueue-Implementation-using-Postgres
Sep 30, 2024
Merged
Feat (Core): PostgresJobQueue Implementation and Job Processing Enhancements #30175
nollymar
merged 35 commits into
master
from
issue-29479-Create-a-default-JobQueue-Implementation-using-Postgres
Sep 30, 2024
Conversation
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
Introduced multiple job lifecycle event classes including `JobCreatedEvent`, `JobStartedEvent`, `JobProgressUpdatedEvent`, `JobCompletedEvent`, `JobFailedEvent`, and `JobCancelledEvent`. Updated `JobQueueManagerAPIImpl` to fire these events at appropriate stages in the job lifecycle to enhance observability and event-driven processing. Updated tests to accommodate the changes in event handling.
Replaced jobId strings with Job objects in event classes to simplify data access and reduce redundancy. Introduced RealTimeJobMonitor for handling real-time job updates, improving event notification efficiency and code maintainability. Updated tests and related classes to accommodate these changes.
Remove the `JobResult` enum and update job processing methods to use an `AbstractJobResult` interface. This refactor centralizes job result handling, differentiates success, failure, and cancellation cases, and incorporates metadata and error details within the job result.
…a-default-JobQueue-Implementation-using-Postgres
This commit adds a PostgreSQL-specific implementation of the JobQueue interface, providing detailed methods for job management using a PostgreSQL database. It also introduces new error handling classes like JobQueueException, JobQueueDataException, and renames ProcessorNotFoundException to JobProcessorNotFoundException for clarity.
Updated job queries to use common table expressions (CTEs) for pagination, ensuring all job retrieval methods now return a JobPaginatedResult object containing job data and pagination details. This improves the consistency and handling of job data across the application. Added new tests to verify the correctness of these changes.
Moved job result set mapping logic from `PostgresJobQueue` to new `DBJobTransformer` utility class. This change improves code modularity, readability, and maintainability by isolating the transformation logic in a dedicated class.
…a-default-JobQueue-Implementation-using-Postgres
…a-default-JobQueue-Implementation-using-Postgres
…a-default-JobQueue-Implementation-using-Postgres
…a-default-JobQueue-Implementation-using-Postgres
Implemented a public getter method for JobQueue in JobQueueManagerAPI. Updated corresponding tests to include assertions for the new method. This enhances testability and ensures the JobQueue dependency is correctly injected.
Decoupled job cancellation logic by introducing a `Cancellable` interface. This improves clarity and separation of concerns, ensuring only processors capable of cancellation implement the relevant method. Updated existing tests to support the new interface and ensured compatibility with the JobQueueManagerAPI.
…a-default-JobQueue-Implementation-using-Postgres
Decoupled job cancellation logic by introducing a `Cancellable` interface. This improves clarity and separation of concerns, ensuring only processors capable of cancellation implement the relevant method. Updated existing tests to support the new interface and ensured compatibility with the JobQueueManagerAPI.
…a-default-JobQueue-Implementation-using-Postgres
This commit introduces a new `JobCancellingEvent` and related logic to handle job cancellations. It also refines the job state management and progress tracking to ensure accurate updates and status changes.
Introduce markAsRunning() method to standardize setting job states to RUNNING. Replace usage of lastRetryTimestamp with completedAt for retry timing. Update tests to reflect changes and improve code readability. Ensure jobs are correctly re-queued with updated states.
…a-default-JobQueue-Implementation-using-Postgres
…a-default-JobQueue-Implementation-using-Postgres
…a-default-JobQueue-Implementation-using-Postgres
Quality Gate passedIssues Measures |
fabrizzio-dotCMS
approved these changes
Sep 30, 2024
nollymar
approved these changes
Sep 30, 2024
nollymar
deleted the
issue-29479-Create-a-default-JobQueue-Implementation-using-Postgres
branch
September 30, 2024 17:44
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces the
PostgresJobQueue
implementation, fulfilling the requirement for a default job queue using PostgreSQL.In the process of developing this implementation, we've made significant improvements to the overall job processing system, including enhancements to the
JobQueueManagerAPIImpl
and related components.Key Features of
PostgresJobQueue
:Improvements to Job Processing System:
JobQueueManagerAPIImpl
Enhancements:Testing and Documentation:
Developed an extensive set of unit and integration tests for the PostgresJobQueue implementation.
Simple class diagram with main operations and interactions
This PR fixes: #29479