Skip to contents

Reusing an ID with an identical submission is idempotent, even after the task has completed, so a lost response can be resubmitted safely. A different submission under that ID raises canard_spawn_conflict. Equality covers the native value and its R type descriptor.

Usage

ca_spawn(
  db,
  name,
  input = NULL,
  queue = "default",
  id = NULL,
  priority = 0L,
  max_failures = 3L
)

Arguments

db

A handle returned by ca_open(), ca_serve(), or ca_connect().

name

Registered handler name.

input

An R value supported by ca_values. No package-imposed byte limit applies to input, results, checkpoints, or error text.

queue

Queue name.

id

Stable task ID (1 to 256 characters), or NULL to generate a UUID.

priority

Integer priority; larger values are claimed first.

max_failures

Number of failures, including expired leases, before a task becomes terminal. Durable sleeps do not consume this budget. Schema version 1 accepts values from 1 through 1,000,000.

Value

The task ID, a character scalar.

Details

A constraint failure is resolved by looking the existing task up rather than writing again. If no task is found, the original storage error stands; if the lookup itself fails, its condition carries that error as submission_error.