Serialization
Pluggable serializers for task arguments and results, with a per-SDK default codec.
Pluggable serializers for task arguments and results, with a per-SDK default codec.
flexiq uses a pluggable serializer for task arguments and results. The default
is SmartSerializerJsonSerializerJsonSerializer,
which uses MessagePack with a cloudpickle fallback for lambdas, closures, and complex objectsemits human-readable JSON bytesemits human-readable JSON bytes via Jackson.
Coming from Celery? Celery defaults to JSON; flexiq's Python default is
SmartSerializer(MessagePack with a cloudpickle fallback). The fallback executes code on load, and it's Python-only — useJsonSerializerfor cross-language or untrusted payloads.
from flexiq import Queue, JsonSerializer
# Use JSON for simpler, cross-language payloads
queue = Queue(serializer=JsonSerializer())import { Queue, MsgpackSerializer } from "@byteveda/flexiq";
// Use msgpack for compact, binary payloads
new Queue({ dbPath: "flexiq.db", serializer: new MsgpackSerializer() });import org.byteveda.flexiq.FlexiQ;
import org.byteveda.flexiq.serialization.MsgpackSerializer;
// Use msgpack for compact, binary payloads
FlexiQ queue = FlexiQ.builder()
.sqlite("flexiq.db")
.serializer(new MsgpackSerializer())
.open();| Serializer | Format | Best for |
|---|---|---|
SmartSerializer (default) | MessagePack + cloudpickle fallback | Mixed payloads; falls back to pickle for complex objects |
CloudpickleSerializer | Binary (pickle) | Complex Python objects, lambdas, closures |
JsonSerializer | JSON | Simple types, cross-language interop, debugging |
CborSerializer | CBOR (wire-envelope tag 0x02) | Cross-SDK tasks — big integers, datetimes, bytes round-trip losslessly |
| Serializer | Format | Best for |
|---|---|---|
JsonSerializer (default) | JSON | Simple types, cross-language interop, debugging |
MsgpackSerializer | Binary (msgpack) | Compact payloads, smaller storage |
CborSerializer | Binary (CBOR, wire-envelope tag 0x02) | Cross-SDK tasks — big integers, Date, bytes round-trip losslessly |
SignedSerializer | Wraps a codec + HMAC-SHA256 | Tamper detection |
EncryptedSerializer | Wraps a codec + AES-256-GCM | Encrypted, authenticated payloads |
| Serializer | Format | Best for |
|---|---|---|
JsonSerializer (default) | JSON (Jackson) | Simple types, cross-language interop, debugging |
MsgpackSerializer | Binary (msgpack) | Compact payloads, smaller storage |
CborSerializer | Binary (CBOR, wire-envelope tag 0x02) | Cross-SDK tasks — big integers, decimals, bytes round-trip losslessly |
SignedSerializer | Wraps a serializer + HMAC-SHA256 | Tamper detection |
EncryptedSerializer | Wraps a serializer + AES-GCM | Encrypted, authenticated payloads |
Implement the Serializer interface with dumps(obj) / loads(data)serialize(value) / deserialize(bytes)serialize(value) / deserialize(bytes, type) methods.
payloadresultperiodic_tasks.args