Skip to content
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

New REST Endpoints for Content Export Job Management #30559

Open
Tracked by #29474
jgambarios opened this issue Nov 1, 2024 · 2 comments
Open
Tracked by #29474

New REST Endpoints for Content Export Job Management #30559

jgambarios opened this issue Nov 1, 2024 · 2 comments

Comments

@jgambarios
Copy link
Contributor

jgambarios commented Nov 1, 2024

Parent Issue

#29575

Task

We need to create REST endpoints to interact with the new ExportContentletProcessor to manage content export operations through the job queue system.

Objectives

  • Implement REST endpoints for content export job management
  • Provide real-time monitoring capabilities
  • Enable configurable export options
  • Support secure file download mechanisms

REST Endpoints Specification

  1. Create Export Job
  • Endpoint: POST /content/export
  • Purpose: Creates and enqueues a new content export job
  • Returns: Job identifier
  1. List Export Jobs
  • Endpoint: GET /content/export
  • Parameters:
    • page: Page number
    • size: Items per page
    • status: Filter by job status
  • Purpose: Lists all enqueued export jobs with pagination
  1. Get Job Status
  • Endpoint: GET /content/export/{jobId}
  • Parameters: jobId
  • Returns:
    • Job state
    • Progress percentage
    • Executing node
    • Download URL (when completed)
  1. Cancel Job
  • Endpoint: POST /content/export/{jobId}/cancel
  • Parameters: jobId
  • Purpose: Cancels a running export job
  1. Monitor Job
  • Endpoint: GET /content/export/{jobId}/monitor
  • Parameters: jobId
  • Type: Server-Sent Events (SSE)
  • Purpose: Real-time job status monitoring
  1. Get Export File
  • Endpoint: GET /content/export/{jobId}/download
  • Parameters: jobId
  • Purpose: Downloads the generated export file
  • Security: Requires valid authentication and authorization

Technical Requirements

Export Features:

  • Secure file storage
  • Download link generation
  • System notifications integration

Job Queue Implementation:

  • Asynchronous job processing
  • Progress tracking
  • Job status management
  • Cancellation support
  • File cleanup management

Error Handling:

  • Proper HTTP status codes
  • Detailed error messages
  • Download link expiration
  • File access validation

Acceptance Criteria

  • All endpoints return appropriate HTTP status codes
  • SSE endpoint provides real-time updates
  • Error messages are clear and actionable
  • Export files are securely stored
  • Download links are properly generated and secured
  • System notifications are sent upon job completion
  • Job cancellation effectively stops processing
  • Exported files are cleaned up according to retention policy

Proposed Objective

Core Features

Proposed Priority

Priority 2 - Important

@fmontes
Copy link
Member

fmontes commented Nov 4, 2024

Review Points for Endpoint Implementation

  1. Error Handling: Since we aim for a fail-continue option, what is our plan for error handling?

  2. Authorization: Can we confirm this alignment with our current permissions model?

  3. Job Cleanup Policies: Cleanup was noted, but can we specify how this will be managed?

Additional Clarifications Needed

  1. Notifications Integration: How do we plan to integrate system notifications for job completions or status updates?

  2. Download Link Expiry: Will the generated download links for completed jobs have an expiration policy? If so, could we detail how this will be managed?

@jgambarios
Copy link
Contributor Author

@fmontes

  1. Error Handling: The error handling including the use of the "fail-continue" option will be handled in Create ExportContentletProcessor reusing existing export logic #30557, this new rest endpoint will just pass the options to the job and respond with the information generated by the new ExportContentletProcessor.

  2. Authorization: The user will be able to export only contents he has access to, the user requesting the export will be passed to the job in order to execute all the required logic with that user allowing us to use the permissions infrastructure.

  3. Job Cleanup Policies: As we are generating files for download, we should have a process, based on some configurable retention policy, where we delete "old" exports.

Additional Clarifications Needed

  1. Notifications Integration: The new job infrastructure already handles status updates, we can monitor any status change, and, on completion, we should use dotCMS system notifications to notify the user, in the admin UI, the export finished and if finished successfully, including the download link.

  2. Download Link Expiry: We should have a configurable retention policy (time) that will be use, by a cleanup process, to delete "expired" exports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Next 1-3 Sprints
Development

No branches or pull requests

3 participants