diff --git a/runtime/catalog-apicurio/src/main/java/io/aklivity/zilla/runtime/catalog/apicurio/internal/ApicurioCatalogHandler.java b/runtime/catalog-apicurio/src/main/java/io/aklivity/zilla/runtime/catalog/apicurio/internal/ApicurioCatalogHandler.java index f73ac4bb3b..80097439c7 100644 --- a/runtime/catalog-apicurio/src/main/java/io/aklivity/zilla/runtime/catalog/apicurio/internal/ApicurioCatalogHandler.java +++ b/runtime/catalog-apicurio/src/main/java/io/aklivity/zilla/runtime/catalog/apicurio/internal/ApicurioCatalogHandler.java @@ -375,7 +375,8 @@ public int encode( } @Override - public int encodePadding() + public int encodePadding( + int length) { return MAX_PADDING_LENGTH; } diff --git a/runtime/catalog-apicurio/src/test/java/io/aklivity/zilla/runtime/catalog/apicurio/internal/ApicurioIT.java b/runtime/catalog-apicurio/src/test/java/io/aklivity/zilla/runtime/catalog/apicurio/internal/ApicurioIT.java index 5905b7a904..3c787fdf0a 100644 --- a/runtime/catalog-apicurio/src/test/java/io/aklivity/zilla/runtime/catalog/apicurio/internal/ApicurioIT.java +++ b/runtime/catalog-apicurio/src/test/java/io/aklivity/zilla/runtime/catalog/apicurio/internal/ApicurioIT.java @@ -164,7 +164,7 @@ public void shouldVerifyMaxPadding() { ApicurioCatalogHandler catalog = new ApicurioCatalogHandler(config, context, 0L); - assertEquals(9, catalog.encodePadding()); + assertEquals(9, catalog.encodePadding(0)); } @Test diff --git a/runtime/catalog-karapace/src/main/java/io/aklivity/zilla/runtime/catalog/karapace/internal/KarapaceCatalogHandler.java b/runtime/catalog-karapace/src/main/java/io/aklivity/zilla/runtime/catalog/karapace/internal/KarapaceCatalogHandler.java index da1e437166..fbdd09e8ec 100644 --- a/runtime/catalog-karapace/src/main/java/io/aklivity/zilla/runtime/catalog/karapace/internal/KarapaceCatalogHandler.java +++ b/runtime/catalog-karapace/src/main/java/io/aklivity/zilla/runtime/catalog/karapace/internal/KarapaceCatalogHandler.java @@ -331,7 +331,8 @@ public int encode( } @Override - public int encodePadding() + public int encodePadding( + int length) { return MAX_PADDING_LENGTH; } diff --git a/runtime/catalog-karapace/src/test/java/io/aklivity/zilla/runtime/catalog/karapace/internal/KarapaceIT.java b/runtime/catalog-karapace/src/test/java/io/aklivity/zilla/runtime/catalog/karapace/internal/KarapaceIT.java index 5ab4852340..9b33c3d3fc 100644 --- a/runtime/catalog-karapace/src/test/java/io/aklivity/zilla/runtime/catalog/karapace/internal/KarapaceIT.java +++ b/runtime/catalog-karapace/src/test/java/io/aklivity/zilla/runtime/catalog/karapace/internal/KarapaceIT.java @@ -164,7 +164,7 @@ public void shouldVerifyMaxPadding() { KarapaceCatalogHandler catalog = new KarapaceCatalogHandler(config, context, 0L); - assertEquals(5, catalog.encodePadding()); + assertEquals(5, catalog.encodePadding(0)); } @Test diff --git a/runtime/engine/src/main/java/io/aklivity/zilla/runtime/engine/catalog/CatalogHandler.java b/runtime/engine/src/main/java/io/aklivity/zilla/runtime/engine/catalog/CatalogHandler.java index 9460c48872..d6b730e261 100644 --- a/runtime/engine/src/main/java/io/aklivity/zilla/runtime/engine/catalog/CatalogHandler.java +++ b/runtime/engine/src/main/java/io/aklivity/zilla/runtime/engine/catalog/CatalogHandler.java @@ -101,7 +101,16 @@ default int encode( return encoder.accept(traceId, bindingId, schemaId, data, index, length, next); } - default int encodePadding() + default int encodePadding( + int length) + { + return 0; + } + + default int decodePadding( + DirectBuffer data, + int index, + int length) { return 0; } diff --git a/runtime/engine/src/test/java/io/aklivity/zilla/runtime/engine/test/internal/model/TestConverterHandler.java b/runtime/engine/src/test/java/io/aklivity/zilla/runtime/engine/test/internal/model/TestConverterHandler.java index 7fb260ee91..3de18061e5 100644 --- a/runtime/engine/src/test/java/io/aklivity/zilla/runtime/engine/test/internal/model/TestConverterHandler.java +++ b/runtime/engine/src/test/java/io/aklivity/zilla/runtime/engine/test/internal/model/TestConverterHandler.java @@ -54,7 +54,7 @@ public int padding( int index, int length) { - return handler.encodePadding(); + return handler.encodePadding(length); } @Override diff --git a/runtime/model-avro/src/main/java/io/aklivity/zilla/runtime/model/avro/internal/AvroReadConverterHandler.java b/runtime/model-avro/src/main/java/io/aklivity/zilla/runtime/model/avro/internal/AvroReadConverterHandler.java index 73a9387a96..6c9d11bfc4 100644 --- a/runtime/model-avro/src/main/java/io/aklivity/zilla/runtime/model/avro/internal/AvroReadConverterHandler.java +++ b/runtime/model-avro/src/main/java/io/aklivity/zilla/runtime/model/avro/internal/AvroReadConverterHandler.java @@ -46,7 +46,7 @@ public int padding( int index, int length) { - int padding = 0; + int padding = handler.decodePadding(data, index, length); if (VIEW_JSON.equals(view)) { int schemaId = handler.resolve(data, index, length); diff --git a/runtime/model-avro/src/main/java/io/aklivity/zilla/runtime/model/avro/internal/AvroWriteConverterHandler.java b/runtime/model-avro/src/main/java/io/aklivity/zilla/runtime/model/avro/internal/AvroWriteConverterHandler.java index 8eb24d2cc7..2889dcf0f5 100644 --- a/runtime/model-avro/src/main/java/io/aklivity/zilla/runtime/model/avro/internal/AvroWriteConverterHandler.java +++ b/runtime/model-avro/src/main/java/io/aklivity/zilla/runtime/model/avro/internal/AvroWriteConverterHandler.java @@ -44,7 +44,7 @@ public int padding( int index, int length) { - return handler.encodePadding(); + return handler.encodePadding(length); } @Override diff --git a/runtime/model-json/src/main/java/io/aklivity/zilla/runtime/model/json/internal/JsonReadConverterHandler.java b/runtime/model-json/src/main/java/io/aklivity/zilla/runtime/model/json/internal/JsonReadConverterHandler.java index 18629549aa..931a6017f9 100644 --- a/runtime/model-json/src/main/java/io/aklivity/zilla/runtime/model/json/internal/JsonReadConverterHandler.java +++ b/runtime/model-json/src/main/java/io/aklivity/zilla/runtime/model/json/internal/JsonReadConverterHandler.java @@ -32,6 +32,15 @@ public JsonReadConverterHandler( super(config, context); } + @Override + public int padding( + DirectBuffer data, + int index, + int length) + { + return handler.decodePadding(data, index, length); + } + @Override public int convert( long traceId, diff --git a/runtime/model-json/src/main/java/io/aklivity/zilla/runtime/model/json/internal/JsonWriteConverterHandler.java b/runtime/model-json/src/main/java/io/aklivity/zilla/runtime/model/json/internal/JsonWriteConverterHandler.java index 28ac68f9a0..d841dfcbc2 100644 --- a/runtime/model-json/src/main/java/io/aklivity/zilla/runtime/model/json/internal/JsonWriteConverterHandler.java +++ b/runtime/model-json/src/main/java/io/aklivity/zilla/runtime/model/json/internal/JsonWriteConverterHandler.java @@ -37,7 +37,7 @@ public int padding( int index, int length) { - return handler.encodePadding(); + return handler.encodePadding(length); } @Override diff --git a/runtime/model-protobuf/src/main/java/io/aklivity/zilla/runtime/model/protobuf/internal/ProtobufReadConverterHandler.java b/runtime/model-protobuf/src/main/java/io/aklivity/zilla/runtime/model/protobuf/internal/ProtobufReadConverterHandler.java index 85470d46c0..a4bfb73ee0 100644 --- a/runtime/model-protobuf/src/main/java/io/aklivity/zilla/runtime/model/protobuf/internal/ProtobufReadConverterHandler.java +++ b/runtime/model-protobuf/src/main/java/io/aklivity/zilla/runtime/model/protobuf/internal/ProtobufReadConverterHandler.java @@ -53,7 +53,7 @@ public int padding( int index, int length) { - int padding = 0; + int padding = handler.decodePadding(data, index, length); if (VIEW_JSON.equals(view)) { int schemaId = handler.resolve(data, index, length); diff --git a/runtime/model-protobuf/src/main/java/io/aklivity/zilla/runtime/model/protobuf/internal/ProtobufWriteConverterHandler.java b/runtime/model-protobuf/src/main/java/io/aklivity/zilla/runtime/model/protobuf/internal/ProtobufWriteConverterHandler.java index 50069f1b4b..21b8d985a0 100644 --- a/runtime/model-protobuf/src/main/java/io/aklivity/zilla/runtime/model/protobuf/internal/ProtobufWriteConverterHandler.java +++ b/runtime/model-protobuf/src/main/java/io/aklivity/zilla/runtime/model/protobuf/internal/ProtobufWriteConverterHandler.java @@ -58,7 +58,7 @@ public int padding( ? catalog.id : handler.resolve(subject, catalog.version); - return handler.encodePadding() + supplyIndexPadding(schemaId); + return handler.encodePadding(length) + supplyIndexPadding(schemaId); } @Override