FlexiQ
Construct the client and the full producer/admin API.
Construct the client and the full producer/admin API.
import org.byteveda.flexiq.FlexiQ;
try (FlexiQ flexiq = FlexiQ.builder().sqlite("flexiq.db").open()) {
// ...
}FlexiQ is AutoCloseable; close() releases the native storage handle.
The FlexiQ API is split across several pages for readability:
| Method | Description |
|---|---|
backend(String) | "sqlite" (default) | "postgres" | "redis". |
url(String) | Connection string: a file path for SQLite, a URL for Postgres/Redis. |
sqlite() / sqlite(path) / postgres(url) / redis(url) | Backend shortcuts. SQLite defaults to .flexiq/flexiq.db. |
poolSize(int) | Connection pool size (SQLite/Postgres). |
schema(String) | Postgres schema (default flexiq). |
prefix(String) | Redis key prefix. |
namespace(String) | Namespace applied to enqueued jobs + the worker scheduler. |
serializer(Serializer) | Payload/result serializer (default JsonSerializer). |
codec(PayloadCodec...) | Global codec chain around the serializer. |
codec(String, PayloadCodec) | Register a named codec for per-task selection (Task.codecs). |
middlewareTimeout(Duration) | How long one middleware hook may take before the worker interrupts it (default 5 seconds; Duration.ZERO disables the bound). A task's own timeout bounds its handler and nothing else, so a before, after, onError or onSleep that blocks holds the attempt open past that limit. Past this budget the hook's thread is interrupted, the overrun is logged against the middleware that caused it, and the chain carries on — failing an attempt over its own instrumentation is the failure mode the hooks exist to avoid. |
autoMigrate(boolean) | Whether opening applies pending schema changes. true (the default) keeps the existing behaviour; false gates every schema change behind migrate(), for a deployment whose database credentials do not permit DDL at runtime. Against an already-current database this changes nothing a caller sees; on fresh or otherwise unmigrated storage, queries fail until migrate() has run, because the tables do not exist yet. |
open() | Open the native backend → FlexiQ. |
open(QueueBackend) | Open over an explicit backend (e.g. a test fake). |
| Method | Description |
|---|---|
enqueue(Task<T>, T) / enqueue(Task<T>, T, EnqueueOptions) | Enqueue a typed payload → job id. |
enqueue(String taskName, Object payload) | Enqueue by task name. |
tryEnqueue(...) | Gate-aware enqueue: Optional.empty() when a gate skips; a Reject still throws. |
enqueueMany(Task<T>, List<T>) / (..., EnqueueOptions) | Batch-enqueue in one storage call → ids in input order, uniqueKey entries deduped. |
enqueueAll(Task<T>, List<T>) | Alias of enqueueMany. |