Repository navigation
Description
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
[-]Implement field-level encryption pipeline in json model with depth-first field-id assignment[/-][+]Declare JsonTransformFactorySpi and wire provider-supplied transforms in json model[/+][-]Declare JsonTransformFactorySpi and wire provider-supplied transforms in json model[/-][+]Declare JsonModelExtFactorySpi and wire provider-supplied pipeline stages in json model[/+]feat(model-json): add JsonModelExtFactorySpi for provider-supplied pi…