Serialization Reference
This reference describes the data formats Lemline reads and writes. None of them is configurable: there are no lemline.serialization.* or schema-registry settings.
Serialization Overview
What | Format |
|---|---|
Workflow definitions | YAML or JSON |
Workflow data (input, output, task results, context) | JSON values |
Messages between runners (commands and events) | Protocol Buffers, binary on the broker |
Workflow state stored in the database | Protocol Buffers as JSON (ProtoJSON) |
Events emitted and received by workflows | CloudEvents in JSON |
HTTP request bodies | JSON |
JSON Schemas ( | JSON Schema draft 2020-12, written in JSON or YAML |
XML, Avro, CBOR and MessagePack are not supported, and there is no schema registry integration.
Workflow Data
Workflow data is always a JSON value: object, array, string, number, boolean or null. Expressions (jq) read and produce JSON values.
Numbers keep their decimal precision.
Dates and times are strings; Lemline does not convert them to another type.
Binary data is represented as a Base64 string, for example the body of an HTTP response returned with
output: raw.
HTTP Content Types
For call: http tasks:
The request body is sent as JSON with
Content-Type: application/json, forpost,putandpatchonly.With
output: content(the default), a response whose content type containsjsonis parsed as JSON, one that containstextbecomes a string, and anything else becomes a Base64 string.
Messaging
Runners exchange workflow commands and events as Protocol Buffers messages carrying the serialized workflow state, so any runner can continue any instance. The format is internal to Lemline: only Lemline runners and the gateway read these destinations.
CloudEvents emitted by emit tasks and consumed by listen tasks use the JSON format of the CloudEvents specification.
Schema Validation
Data that does not match its schema raises a validation error. External schemas referenced by URL are fetched at validation time.
Error Handling
Situation | Result |
|---|---|
Invalid workflow definition |
|
Data does not match a schema |
|
An expression fails |
|
A message cannot be decoded by a runner | The message goes to the dead-letter destination of its source |
Run the Examples
Every example on this page is a complete workflow. Complete the SQLite setup, save each example under the file name used below, and run the commands from the setup directory. With the JAR, substitute java -jar lemline.jar for bin/lemline.
Keep the setup worker running and use a second terminal in the setup directory.
Example | Expected result |
|---|---|
| Completes with |
| Refused by |