Pollen In progress — package v0.9.1

Pollen

Amalgame's peer-to-peer data bus + declarative workflow orchestrator. No central broker, no ZooKeeper cluster — every node talks directly to the others, and they all read the same workflow.json on a shared network mount to know what to do at each step. Sister project to Mosaic: where Mosaic handles your inbound HTTP traffic, Pollen distributes data between your services and coordinates their processing.

Why "Pollen"

Pollen travels without a central coordinator: carried from flower to flower by autonomous carriers, it transports the most valuable thing to propagate — genetic information. Each carrier knows where to go, the pollen knows what to become. That is exactly the execution model we're building: autonomous nodes that emit and receive directly, on a network where coordination lives in the shared data (the workflow.json), not in a conductor.

Where Pollen stands

Pollen is in progress. It started as a Node.js prototype (TARMeule). Its core is now an Amalgame package, amalgame-pollen v0.9.1, installed with amc package add pollen. Its tests run in CI for every release. Three repos carry the Pollen name:

  • amalgame-pollen (v0.9.1) — the package: TCP transport, mutual TLS, capability registry, v3 workflow engine, on-disk outbox. This is the one to use, in a Mosaic app or any Amalgame program.
  • pollen — the first CLI, from before the package (v0.2.0-dev, stalled since June 2026). Its installer still builds the UDP node of the first prototype.
  • pollen-manager — a draft workflow.json editor, stalled since June 2026 (see below).

Two layers: a peer-to-peer bus and a workflow orchestrator

Pollen doesn't look like RabbitMQ, Kafka or NATS — which are all central brokers. Pollen is closer to a mix of ZeroMQ (for transport) and Argo Workflows (for orchestration), but fully decentralized:

  • Transport — the amalgame-pollen package keeps one TCP connection open per peer, newline-delimited JSON (one message = one line), with an application-level ACK. Optionally, mutual TLS on every connection. Direct node to node, no broker in between.
  • Coordination — a workflow.json file (schema pollen/v3) on a shared network mount. It describes the actions (abstract topics) and the entries (who reacts to what, and how). Each server reads the file, identifies its role and runs its part.

The workflow.json is the orchestrator. There is no "orchestrator" process to run. The file is declarative, the nodes are autonomous — each one knows what to do at every step.

When to use Pollen

  • Local network / LAN — IoT, SCADA, industrial sensors, factory supervision
  • Distributed processing pipelines — a transformation chain (acquisition → filtering → aggregation → archiving) across several machines
  • Symmetric topologies — no client/server relationship, every node emits and receives
  • No broker, no workflow server — all you need is a folder shared between the nodes (NFS, SMB)
  • Orchestration in the data — changing the workflow = editing one JSON file and reloading it (WorkflowLoadV3), no code change
  • Resilient to network breaks — a node that comes back re-reads workflow.json and resumes its place; with the on-disk outbox, the messages meant for it wait for it

workflow.json v3 — the declarative orchestrator

The core idea: no process decides who does what. The decision lives in a JSON file dropped on a shared network mount (NFS, SMB, cluster share). The pollen/v3 schema brings a real control-flow engine — no longer just a static DAG.

// workflow.json — annotated example: a temperature processing chain
// (remove the // comments before loading it: JSON does not allow them)
{
  "schema":  "pollen/v3",
  "name":    "telemetry-pipeline",
  "version": 1,

  // actions = abstract topics, resolved via the capability registry
  "actions": {
    "filter":  { "topic": "temperature.filtered" },
    "archive": { "topic": "temperature.archive" },
    "alert":   { "topic": "ops.alert" }
  },

  // entries = handlers triggered by an incoming topic
  "entries": [
    {
      "name": "main",
      "on":   "temperature.raw",
      "do": [
        { "type": "call", "action": "filter" },
        { "type": "if", "cases": [
            { "when": "msg.data.value > 80",
              "do": { "type": "call", "action": "alert", "mode": "all" } },
            { "else": true,
              "do": { "type": "call", "action": "archive" } }
        ] }
      ]
    }
  ]
}

The v3 engine is a tree-walker that runs a sequence of typed steps:

  • ✓call — invoke an action; mode: "one" | "all" (one provider or all), on_error: "fail" | "log" | "drop" | "buffer" (buffer: on-disk outbox, see below)
  • ✓if — first-match branching (cases with when + else: true)
  • ✓for / while — iterate a list, loop bounded by maxIter
  • ✓set — mutate execution state via a CEL-lite expression
  • ✓goto + anchor — jump between entries (with params / returns, call stack up to 64 frames) and a named resumption point for retry patterns

Changing the topology = editing one JSON file. Pollen.WorkflowValidateV3 checks the file before loading (undefined entries, goto cycles, anchors, expression syntax).

Amalgame API — a node that follows the workflow

The server-side app is minimal: declare your role and the shared dir, load the v3 workflow, advertise your capabilities, then block in the listen loop. Pollen handles the rest (v3 dispatch, routing to providers, load balancing).

namespace App
import Amalgame.Pollen

public class Program {
    public static void Main(string[] args) {
        Pollen.WorkflowSetSharedDir("./shared")
        Pollen.WorkflowSetSelf("filter-1", "127.0.0.1", 5000)
        Pollen.WorkflowLoadV3("./shared/workflow.json")

        // Advertise this node's capabilities + read the others' registry
        Pollen.StartCapabilityWriter("filter-1", "127.0.0.1", 5000)
        Pollen.StartCapabilityReader()
        Pollen.SetLoadBalance(true)        // registry-resolved forwarding

        Pollen.StartListener(5000)         // TCP loop: receive, v3 dispatch, re-emit
    }
}

Inject a message into the workflow from the outside (a sensor, a Mosaic app, a script):

// fire-and-forget
Pollen.Publish("proc-01.lan", 5000, "temperature.raw", 1, dataJson)

// wait for the application-level ACK (timeout in ms)
Pollen.PublishSync("proc-01.lan", 5000, "temperature.raw", 1, dataJson, 2000)

What the package does (v0.9.1)

The Node.js prototype (github.com/BastienMOUGET/TARMeule) served as the functional reference. Here's what v0.9.1 actually does:

shipped

TCP transport + ACK

JSON envelopes, one per line (messageId, type, topic, data, timestamp), application-level ACK. One connection kept open per peer: messages to the same peer arrive in order.

shipped

v3 workflow engine

JSON → AST loader, validator (8 rules), tree-walking dispatcher. Steps call / goto / anchor / if / for / while / set.

shipped

CEL-lite expressions

Lexer + Pratt parser + evaluator. Arithmetic, comparisons, booleans, in, ternary; builtins len, int, float, string, contains, startsWith… Paths state.X, params.Y, msg.data.Z.

shipped

Capability registry + load balancing

Each node advertises its actions in capabilities/. The workflow's actions are resolved at runtime to a concrete provider, with a power-of-two-choices load balancer.

shipped

Execution tracing

A message's state (state.X) lives in memory while it is processed. Every hop is recorded in sharedDir/executions/.

v0.4

Application handlers

Pollen.OnTopic(topic, function): your code handles a topic, for example to write it to a database. The topic is advertised in the capability registry.

v0.6

On-disk outbox

With on_error: "buffer", a call step writes the message to disk and deletes it only when the receiver ACKs it. Nothing is lost while the receiver is absent or restarting. At-least-once delivery, in order (so a message can arrive twice).

v0.7

Mutual TLS

Pollen.SetTls(ca, cert, key): every connection runs TLS (1.2 minimum), with a certificate on both sides. Only nodes signed by the site CA can publish or be reached. Without SetTls, the bus stays on clear TCP.

v0.8

Per-topic rights in the certificate

The site CA writes into each node's certificate the topics it may publish (pollen:publish:<topic>). Every listener checks every message. Nothing to configure on the receivers.

v0.9

ACK after the handler

With SetAckAfterHandler(true), the ACK leaves once your OnTopic handler returned 0. Together with the on-disk outbox, a message is no longer lost between receipt and storage.

Pollen Manager — a stalled draft

pollen-manager was meant to be a Mosaic application to edit workflow.json and follow the executions written in sharedDir/executions/. It is a draft (v0.1.0-dev): it has no published version, has not moved since June 2026 and still depends on Pollen v0.3.0. Don't count on it for now.

Why it was ported to Amalgame

The Node.js prototype was functional but heavy to deploy on the target devices (sensors, industrial gateways, PLCs): Node.js and its ~50 MB runtime, process keep-alive, npm install… The AM port gives:

  • ✓A native binary — about 160 KB for the example node above (Linux x86-64), linked against libgc and OpenSSL
  • ✓No Node.js to install — tested on Linux (Ubuntu 24.04) and Windows 11; macOS is handled in the code but not tested yet
  • ✓Reusable — a package, not a frozen binary: embeddable in a Mosaic app (HTTP → Pollen bridge)
  • ✓Mutual TLS via OpenSSL — one certificate per node, signed by the site CA (v0.7)

Roadmap

v0.1 → v0.3 · May 2026

The core

TCP transport + ACK, v3 workflow engine (tree-walker + 8 validation rules), CEL-lite expressions, capability registry + power-of-two load balancing, execution tracing.

v0.4 → v0.5 · Nov 2026

Handlers and portability

Pollen.OnTopic. Windows (MinGW-w64) and macOS handled in the code. One TCP connection kept open per peer, instead of one per message.

v0.6 · Nov 2026

On-disk outbox

on_error: "buffer": at-least-once delivery, in order. SetListenAddress to keep a node local.

v0.7 → v0.8 · Nov 2026

Security

Mutual TLS on every connection. Per-topic publish rights, carried by the certificate. PeerName and PeerClaim tell the handler who sent the message.

v0.9 → v0.9.1 · Nov 2026

ACK after the handler

SetAckAfterHandler. Fix: a wait cut short by the garbage collector's signals resumes (PublishSync, reads, writes, TLS handshake).

to do

The tools on the package

Rebuild the pollen CLI on the package: its installer still builds the old UDP node. pollen-manager needs bringing up to date: it has been stalled since June on v0.3.0.

missing

Certificate revocation

No revocation list yet. To remove a node: re-issue the site CA, or give certificates a short lifetime.

missing

ACK after processing in workflows

SetAckAfterHandler only applies to OnTopic handlers. A topic handled by a v3 workflow is still acknowledged on receipt.

missing

macOS

The code has handled it since v0.4, but it has not run on a Mac yet.

not planned

Several workflows per process

One workflow engine per process, and no hook on each step of the dispatcher. Nothing is planned for now.

What Pollen is not

  • Not a broker — no central log, no Kafka-style replay. The on-disk outbox keeps, on the sender's side, the messages of call steps with on_error: "buffer" until they are ACKed. A direct Publish to an absent node fails and is not kept.
  • Not a full Temporal / Argo Workflows — the v3 engine does control flow (if/for/while/goto + state), but no durable execution history, no transactional saga with rollback.
  • Not multi-datacenter — designed for LAN or VPN-LAN. Not meant to cross the open Internet.
  • Not a Mosaic replacement — to expose a web API to clients outside the LAN, that's Mosaic.
  • Not a transactional MOM — no cross-topic atomic transactions, no dead-letter queue, no global ordering guarantees.
  • Not hard real-time — Amalgame's garbage collector stops every thread during a collection.

For those cases, the ecosystem offers the right third-party tools: Kafka for durable replay, RabbitMQ for transactional workflows, MQTT for broker-centralized IoT. Pollen plays in the "real-time LAN pipeline, no broker, no orchestration server" slot.

Try Pollen

Pollen is in progress. The package is at v0.9.1: amc package add pollen, with amc 0.8.52 or later and OpenSSL.