Skip to main content

JobArgs

Derive Macro JobArgs 

Source
#[derive(JobArgs)]
{
    // Attributes available to this derive:
    #[river]
}
Expand description

Derives riverqueue::JobArgs.

The type must declare #[river(kind = "...")]. Other type-level options:

  • aliases("old_kind", ...): former kinds handled by the same worker.
  • queue = "...", max_attempts = N, priority = N, pending = true, and tags("a", "b"): default insertion options.
  • unique(...): makes the job unique by default. Options are by_args, by_args("nested.path", ...), by_period = "1h" (a duration of at least one second, such as "90s" or "1h30m"), by_queue, by_state(available, running, ...), and exclude_kind.
  • insert_opts = path::to_fn: a fn() -> InsertOpts whose options are overlaid on the attribute defaults.
  • crate = "path": the path to riverqueue when it is renamed or re-exported.

Fields marked #[river(unique)] are the arguments hashed by unique(by_args), together with any by_args paths; without either, every argument is hashed. Marking a field requires unique(by_args) on the type. Field names follow Serde’s serialization-side rename and rename_all. A unique field may be conditionally omitted with skip_serializing_if, but cannot be flattened or unconditionally skipped. by_args paths separate nested names with .; escape a literal dot or backslash with a backslash (for example, "user\\.id" selects the single JSON name user.id). Tagged fields use their whole serialized name as one component, even when that name contains a dot.