pub struct EnqueueOptions {
pub max_retries: u32,
pub labels: HashMap<String, String>,
pub scheduled_at: Option<DateTime<Utc>>,
pub max_cost_usd: Option<Decimal>,
pub created_by: Option<RunActor>,
pub idempotency_key: Option<String>,
pub concurrency_key: Option<String>,
pub concurrency_limits: Vec<ConcurrencyLimit>,
pub priority: Option<i16>,
pub worker_tags: Vec<String>,
}Expand description
Optional settings for Engine::enqueue_handler_with_options.
All fields fall back to handler or server defaults when left at their
Default value.
§Examples
use ironflow_engine::engine::EnqueueOptions;
use rust_decimal::Decimal;
let options = EnqueueOptions {
max_retries: 3,
max_cost_usd: Some(Decimal::new(50, 2)),
..Default::default()
};
assert_eq!(options.max_retries, 3);Fields§
§max_retries: u32Number of automatic retries granted to the run.
labels: HashMap<String, String>Labels merged on top of the handler’s default labels.
scheduled_at: Option<DateTime<Utc>>Defer execution until this instant instead of running as soon as a worker picks the run up.
max_cost_usd: Option<Decimal>Cost cap for the run. Overrides both the handler default and the server
default. None falls back to
BudgetConfig::resolve_run_cap.
created_by: Option<RunActor>Authenticated principal that triggered the run. None for cron,
webhook, and programmatic triggers.
idempotency_key: Option<String>Idempotency key binding this enqueue to a single run.
When set and already bound to a run created within
IDEMPOTENCY_WINDOW,
nothing is enqueued and the original run is replayed.
concurrency_key: Option<String>Concurrency key making the run exclusive.
When set, the run is refused with EngineError::ConcurrencyConflict
while another non-terminal run holds the same key. The key is released
once the holder reaches a terminal state.
concurrency_limits: Vec<ConcurrencyLimit>Concurrency groups the run belongs to, each with the maximum number of root runs of that group allowed to execute at once.
Unlike concurrency_key, the run is always
created: it stays pending until every group is under its limit. Empty
means no limit. Invalid limits are refused with
EngineError::InvalidConcurrencyLimit.
priority: Option<i16>Queue priority of the run, overriding
WorkflowHandler::priority.
Workers pick the pending run with the highest priority first, then the
oldest among equal priorities. None falls back to the handler’s
priority, clamped to the accepted range. An explicit value outside
MIN_PRIORITY..=MAX_PRIORITY
is refused with EngineError::InvalidPriority.
Worker tags the run requires, merged with the handler’s
required_worker_tags.
Only a worker carrying every tag picks the run. Invalid tags are
refused with EngineError::InvalidWorkerTag.