Version v1.x
One-Off and Delayed Jobs
Available in
.NET
Node.js
Python
Enqueue immediate and scheduled runs using the DurableStack client API.
Use the client/runtime API for ad-hoc and scheduled-once execution.
Enqueue immediately
var runId = await durableClient.EnqueueAsync<SendWelcomeEmailJob>(
new SendWelcomeEmailArgs { Email = "[email protected]" },
cancellationToken);
const runId = await runtime.enqueue("send-welcome-email", {
email: "[email protected]"
});
Schedule for later
var runAtUtc = DateTimeOffset.UtcNow.AddMinutes(30);
var runId = await durableClient.ScheduleAsync<SendWelcomeEmailJob>(
new SendWelcomeEmailArgs { Email = "[email protected]" },
runAtUtc,
cancellationToken);
const runAtUtc = new Date(Date.now() + 30 * 60 * 1000).toISOString();
const runId = await runtime.schedule("send-welcome-email", {
email: "[email protected]"
}, runAtUtc);
Cancel a run
var cancelled = await durableClient.CancelRunAsync(runId, cancellationToken);
const cancelled = await runtime.cancelRun(runId);
Query scheduled and recent runs
var recent = await runQueryService.GetRecentRunsAsync(50, cancellationToken);
var pending = await runQueryService.GetRunsByStatusAsync("pending", 50, cancellationToken);
const recent = await runtime.getRecentRuns(50);
const pending = await runtime.getRunsByStatus("pending", 50);
Practical guidance
- Use delayed jobs for time-based follow-up work that is not recurring.
- Keep payload DTOs version-safe and backward-compatible where possible.
- Use run query APIs to verify enqueue/schedule behavior in integration tests.