FluxbaseJobs
//fluxbase-kotlin/io.github.nimbleflux.fluxbase.jobs/FluxbaseJobs
FluxbaseJobs
Section titled “FluxbaseJobs”[jvm]
class FluxbaseJobs(http: FluxbaseHttpClient)
Background Jobs module — port of FluxbaseJobs from sdk/src/jobs.ts.
Submit, track, and cancel background jobs. Fluxbase’s jobs surface has no Supabase equivalent — this is a Fluxbase-only feature.
NOTE: The TS SDK has a bug on jobs.ts:64 — it calls the unregistered path /rest/v1/user_profiles instead of /api/v1/tables/user_profiles. The getCurrentUserRole() auto-population of onBehalfOf for service-role clients is not ported here (it requires app-specific user_profiles knowledge); callers pass onBehalfOf explicitly if needed.
Usage:
val (job, error) = client.jobs.submit("trip-detection", mapOf("date" to "2024-01-01"), SubmitJobOptions(namespace = "wayli"))val (status, _) = client.jobs.get(job!!.id)Constructors
Section titled “Constructors”| FluxbaseJobs | [jvm] constructor(http: FluxbaseHttpClient) |
Functions
Section titled “Functions”| Name | Summary |
|---|---|
| cancel | [jvm] suspend fun cancel(jobId: String): FluxbaseResponse<Job> Cancel a running job. POSTs /api/v1/jobs/{id}/cancel. |
| get | [jvm] suspend fun get(jobId: String): FluxbaseResponse<Job> Get a job by ID. GETs /api/v1/jobs/{id}. |
| getLogs | [jvm] suspend fun getLogs(jobId: String, afterLine: Int? = null): FluxbaseResponse<List<ExecutionLog>> Get job execution logs. GETs /api/v1/jobs/{id}/logs. |
| list | [jvm] suspend fun list(status: String? = null, namespace: String? = null, limit: Int? = null, offset: Int? = null): FluxbaseResponse<List<Job>> List jobs. GETs /api/v1/jobs with optional filters. |
| retry | [jvm] suspend fun retry(jobId: String): FluxbaseResponse<Job> Retry a failed job. POSTs /api/v1/jobs/{id}/retry. |
| submit | [jvm] suspend fun submit(jobName: String, payload: Any? = null, options: SubmitJobOptions = SubmitJobOptions()): FluxbaseResponse<Job> Submit a new job for execution. POSTs to /api/v1/jobs/submit. Port of submit() in jobs.ts:130. |