Repository navigation
Description
Describe the desired outcome from the user's perspective
As a Zilla operator, I want the protobuf 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 Protobuf for Avro throughout:
// io.aklivity.zilla.runtime.model.protobuf.ext, model-protobuf's first exported package
public interface ProtobufModelExtFactorySpi extends FactorySpi
{
ProtobufModelExt create(Configuration config);
}
public interface ProtobufModelExt
{
String name();
ProtobufModelExtContext supply(EngineContext context);
}
public interface ProtobufModelExtContext
{
ProtobufModelExtHandler supplyHandler(ProtobufSchema schema, ProtobufModelConfig config);
}
public interface ProtobufModelExtHandler
{
ProtobufTransformable transform(ProtobufTransformable stream);
}ProtobufTransformable is a new, minimal interface in common-protobuf — the same shape as common-avro's AvroTransformable — that common-protobuf'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-protobuf change this issue needs — common-protobuf otherwise stays a pure codec library with no engine/config dependency.
Registered via META-INF/services/io.aklivity.zilla.runtime.model.protobuf.ext.ProtobufModelExtFactorySpi. Any number of implementations may be installed at once; every one discovered contributes independently, via Factory.instantiate(ServiceLoader.load(ProtobufModelExtFactorySpi.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: ProtobufModelFactorySpi.create(Configuration) discovers every installed ProtobufModelExtFactorySpi; the protobuf 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 protobuf 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 ProtobufModelConfig. This issue declares no opinion on what any installed extension is for.
4. Coverage
Mirror #1681 §4: SPI discovery via a test ProtobufModelExtFactorySpi, per-worker ProtobufModelExt#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-protobuf's option-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 protobuf model[/-][+]Declare ProtobufTransformFactorySpi and wire provider-supplied transforms in protobuf model[/+][-]Declare ProtobufTransformFactorySpi and wire provider-supplied transforms in protobuf model[/-][+]Declare ProtobufModelExtFactorySpi and wire provider-supplied pipeline stages in protobuf model[/+]feat(model-protobuf): add ProtobufModelExt SPI for provider-supplied …