Jobs API
Job results, cancellation, listing, and error history.
Job results, cancellation, listing, and error history.
Signatures on this page are generated from FlexiQ.java — see the
symbol index for the rest of the surface.
flexiq.getJob()Optional<Job> getJob(String jobId)A job snapshot — status, progress, timestamps. Empty when no job has that id.
flexiq.awaitJob()Optional<Job> awaitJob(String jobId, Duration timeout)Block until the job reaches a terminal state; throws once timeout elapses.
flexiq.getResult()<R> Optional<R> getResult(String jobId, Class<R> type)
Optional<byte[]> getResult(String jobId)The job's stored result, raw or deserialized into
type. Empty while the job is still running, and after its result TTL expires.
flexiq.cancel()boolean cancel(String jobId)Cancel a pending job. Returns false once it has started — use
requestCancel for a running one.
flexiq.requestCancel()boolean requestCancel(String jobId)Ask a running job to stop. Cooperative: the handler observes it through
isCancelRequested and returns.
flexiq.isCancelRequested()boolean isCancelRequested(String jobId)Whether a cancel has been requested for this job. Poll it from long-running handlers; a job that never checks runs to completion.
flexiq.setProgress()void setProgress(String jobId, int progress)Record 0–100 progress for inspection and the dashboard.
flexiq.listJobs()List<Job> listJobs(JobFilter filter)List jobs by status, queue or task, newest first. listJobsAfter is the
keyset-paginated twin — pass a page's cursor back as after.
flexiq.jobErrors()List<JobError> jobErrors(String jobId)Per-attempt error history, oldest attempt first.
flexiq.replayJob()String replayJob(String jobId)Re-enqueue a copy of a job with its original payload, and record the replay. A new job, not a resumed one: fresh id, fresh retry budget, and the original row untouched. Returns the new id.
flexiq.getReplayHistory()List<ReplayEntry> getReplayHistory(String jobId)Every replay of a job, newest first. The audit trail for "we retried this by hand", which is otherwise invisible — a replay looks like an unrelated job.
flexiq.jobDag()JobDag jobDag(String jobId)The dependency graph reachable from a job: nodes plus edges pointing dependency → dependent. Transitive in both directions, so it answers "what is this waiting on, and what is waiting on it" in one call.
Dependency edges never cross namespaces — an enqueue that would create one is rejected — so the graph is scoped by its anchor job. A job in another namespace comes back with no edges, exactly like an unknown id.
Terminal jobs are moved out of the hot jobs table into the archive, so
listings and dispatch scans stay fast without losing the history. The sweep
belongs to the worker; the archive keeps its own
retention window.
flexiq.listArchivedAfter()Page<Job> listArchivedAfter(long limit, String after)The archive, keyset-paginated and ordered by completed time. Pass the previous
page's cursor back as after, or null for the first page; the cursor on the
returned Page is null once there is nothing left.
Prefer this to an offset walk. An offset re-scans everything it skips, and a job archived mid-walk shifts every later offset by one, so rows get seen twice or not at all. Treat the cursor as opaque — do not build or parse one.