Skip to content

Declare JsonModelExtFactorySpi and wire provider-supplied pipeline stages in json model #1682

Closed

Description

@jfallows

Describe the desired outcome from the user's perspective

As a Zilla operator, I want the json model to let an installed module contribute its own pipeline stages — for whatever purpose that module defines — without oss zilla needing to know or declare what that purpose is.

Acceptance criteria

1. The SPI

Mirror #1681 §1 exactly, substituting Json for Avro throughout:

// io.aklivity.zilla.runtime.model.json.ext, model-json's first exported package

public interface JsonModelExtFactorySpi extends FactorySpi
{
    JsonModelExt create(Configuration config);
}

public interface JsonModelExt
{
    String name();
    JsonModelExtContext supply(EngineContext context);
}

public interface JsonModelExtContext
{
    JsonModelExtHandler supplyHandler(JsonSchema schema, JsonModelConfig config);
}

public interface JsonModelExtHandler
{
    JsonTransformable transform(JsonTransformable stream);
}

JsonTransformable is a new, minimal interface in common-json — the same shape as common-avro's AvroTransformable — that common-json's pipeline-description type now extends, so an extension can append stages to an in-progress stream without depending on that type's fuller terminal-bearing API. This is the only common-json change this issue needs — common-json otherwise stays a pure codec library with no engine/config dependency.

Registered via META-INF/services/io.aklivity.zilla.runtime.model.json.ext.JsonModelExtFactorySpi. Any number of implementations may be installed at once; every one discovered contributes independently, via Factory.instantiate(ServiceLoader.load(JsonModelExtFactorySpi.class)). Installed extensions simply compose, each appending its own stage(s) ahead of the model's own adapter stage.

2. Composition and caching

Same pattern as #1681 §2: JsonModelFactorySpi.create(Configuration) discovers every installed JsonModelExtFactorySpi; the json model's handler folds each extension's handler into the pipeline when constructing it for a resolved schema, ahead of the model's own decode/encode adapter stage, reusing whatever per-schema-id pipeline cache the json model already has (mirroring model-avro's existing Int2ObjectCache pattern) — no new caching mechanism needed. A deployment with zero installed extensions pays nothing: the fold is a no-op and the assembled pipeline carries no extra stage.

3. Scope

This SPI defines only the generic composition mechanism above, exactly per #1681 §3. Any installed extension's own purpose, and any config surface it needs, is entirely its own design, attached via the Config/ConfigBuilder extension mechanism (ModelExtInfo/ConfigExtAdapter, delivered per #2360) rather than any oss-declared field on JsonModelConfig. This issue declares no opinion on what any installed extension is for.

4. Coverage

Mirror #1681 §4: SPI discovery via a test JsonModelExtFactorySpi, per-worker JsonModelExt#supply invocation, supplyHandler invoked once per schema id with a stage installed ahead of the model's own adapter, multiple registered extensions composing in discovery order, and a zero-extension deployment producing an unmodified pipeline.

Additional context

Blocked on #2302 only in the sense that an installed extension wanting tag-based field selection needs common-json's annotation-retention work — this SPI itself has no annotation dependency.

Sequenced after #1680 in this epic's plan, and after #1681 shipping first as the pattern to mirror (done); this SPI's own discovery mechanism (Factory, Configuration, EngineContext) is pre-existing engine plumbing that predates #1680, not something #1680 itself introduces — there is no hard technical dependency between them.

Activity

  1. added theissue type on Mar 30, 2026
  2. changed the title [-]Implement field-level encryption pipeline in json model with depth-first field-id assignment[/-] [+]Declare JsonTransformFactorySpi and wire provider-supplied transforms in json model[/+] on Aug 4, 2026
  3. self-assigned this
    on Aug 5, 2026
  4. changed the title [-]Declare JsonTransformFactorySpi and wire provider-supplied transforms in json model[/-] [+]Declare JsonModelExtFactorySpi and wire provider-supplied pipeline stages in json model[/+] on Aug 14, 2026
  5. added a commit that references this issue on Aug 16, 2026
    b0f704f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions