Skip to content

Batch enqueue and batches ​

Two different things share the word:

Batch enqueueBatches
EditionCorePro
What it isOne call that stores up to 500 jobsA group of jobs with callbacks when the group finishes
WhereAll 8 SDKs (enqueue_many), POST /api/v1/sdk/jobs/batchCrystal only (JoobQPro::Batch)

Batch enqueue (Core) ​

enqueue_many (enqueueMany, EnqueueMany, EnqueueManyAsync) sends jobs with POST /sdk/jobs/batch{jobs: [...]}, each what POST /sdk/jobs takes, 1 to 500 per call (the Python client splits longer lists into calls of 500). Each job is stored as a single enqueue would store it (sealed fields sealed, a delay parks it, a held unique_key answers deduplicated), in one pipeline, with one audit row (sdk.job.enqueue_batch).

  • The answer is 201 {jobs: [{jid, queue, status}]}, one per job, in order.
  • All or nothing on validation: one invalid job refuses the whole batch with 422 naming it (jobs[3]: ...), and no job is stored. So does one job that needs Pro (a unique release mode) on a deployment without a key (402).

Batches with completion callbacks (Pro, Crystal) ​

ProBatches needs a JoobQ Pro key. Without one every Core feature keeps working: the Pro routes of the SDK gateway answer 402 pro_required and the console's Pro routes are not served. Get a licence · Core and Pro · Pro features index

JoobQ Pro's JoobQPro::Batch groups Crystal jobs and runs callback jobs when the group is done: on_complete, on_success and on_failure take a BatchCallback class. Members are added with add_job inside jobs { ... }, which seals the batch when the block ends; status answers Pending (not sealed yet), Running, then Success (no member failed) or Complete. It needs a Durable::Batches service, whose construction checks the Pro licence (JoobQPro::LicenseError without one). See the JoobQ Pro documentation for the full API.

Coming to the SDKs

There is no SDK or gateway route for Pro batches at this release. A design for them is open (the likely shape: a completion job enqueued when the batch finishes).

JoobQ Core is MIT licensed. JoobQ Pro needs a licence key.