Class DurableJobsMetaDataProvider

java.lang.Object
com.kingsrook.qqq.backend.core.jobs.DurableJobsMetaDataProvider

public class DurableJobsMetaDataProvider extends Object
Defines the durable-jobs tables (jobs_job, jobs_chunk, jobs_row_error, jobs_event, jobs_worker), their possible-value sources, joins, the record lock, and the job control processes. Same pattern as SavedBulkLoadProfileMetaDataProvider:
new DurableJobsMetaDataProvider().defineAll(instance, "rdbms", enricher);
Without the qbit-jobs app the tables still get standard screens. Security: a record lock on jobs_job.userId (key type jobs_user) - users see their own jobs; the jobs_user_all_access key (granted for the jobs_admin permission by DurableJobsSecurity.applyToSession) sees all. Child tables are locked through their join to jobs_job.
  • Constructor Details

    • DurableJobsMetaDataProvider

      public DurableJobsMetaDataProvider()
  • Method Details

    • defineAll

      public void defineAll(QInstance instance, String backendName, Consumer<QTableMetaData> backendDetailEnricher) throws QException
      Add every durable-jobs table, join, possible-value source, security key type and control process to the instance.
      Throws:
      QException
    • esbTableNames

      public static List<String> esbTableNames()
      Names of the main tables a host may wire into its ESB (each main table publishes table events). Core does not depend on qqq-esb.
    • snakeCaseColumnNames

      public static Consumer<QTableMetaData> snakeCaseColumnNames()
      A backend-detail enricher that maps every field to a snake_case column (rowsDone -> rows_done), for databases whose schema uses snake_case. Pass it as defineAll's enricher, or compose it with your own.
    • childJoinName

      public static String childJoinName(String childTable)
      Name of the join from jobs_job to a child table.
    • defineJobTable

      public QTableMetaData defineJobTable(String backendName)
      jobs_job: one row per durable job.
    • defineChunkTable

      public QTableMetaData defineChunkTable(String backendName)
      jobs_chunk: the unit of work a worker leases.
    • defineRowErrorTable

      public QTableMetaData defineRowErrorTable(String backendName)
      jobs_row_error: which rows failed and why.
    • defineEffectTable

      public QTableMetaData defineEffectTable(String backendName)
      jobs_effect: the transactional outbox of side effects outside the job's database (spec section 2.13). Written in the chunk's transaction; delivered by the dispatcher; idempotencyKey is unique (jobId:chunkSeq:rowKey:effect).
    • defineEventTable

      public QTableMetaData defineEventTable(String backendName)
      jobs_event: the timeline of a job. Type leads the fields: most events are job-level, so a (usually empty) chunk column first would leave lists, such as the job's Events child list, without a readable first column.
    • defineWorkerTable

      public QTableMetaData defineWorkerTable(String backendName)
      jobs_worker: which pods run jobs. Leases never depend on it.
    • defineUploadTable

      public QTableMetaData defineUploadTable(String backendName)
      jobs_upload: files uploaded through POST /uploads (the bytes live in the uploads storage table; this row is the opaque ref, its owner and expiry).
    • defineLogTable

      public QTableMetaData defineLogTable(String backendName)
      Append-only redacted log, secured through the parent job.