You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ex...@apache.org on 2021/09/20 12:44:25 UTC
[nifi] branch main updated: NIFI-8966 - Confluent Schema Registry -
get schema without subject/version
This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 2e99883 NIFI-8966 - Confluent Schema Registry - get schema without subject/version
2e99883 is described below
commit 2e998839eb50fe873b0487bed73049b6e878e75c
Author: Pierre Villard <pi...@gmail.com>
AuthorDate: Sat Jul 31 14:37:51 2021 +0200
NIFI-8966 - Confluent Schema Registry - get schema without subject/version
This closes #5266
Signed-off-by: David Handermann <ex...@apache.org>
---
.../confluent/schemaregistry/client/RestSchemaRegistryClient.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/nifi-nar-bundles/nifi-confluent-platform-bundle/nifi-confluent-schema-registry-service/src/main/java/org/apache/nifi/confluent/schemaregistry/client/RestSchemaRegistryClient.java b/nifi-nar-bundles/nifi-confluent-platform-bundle/nifi-confluent-schema-registry-service/src/main/java/org/apache/nifi/confluent/schemaregistry/client/RestSchemaRegistryClient.java
index 33e74bc..3bc663c 100644
--- a/nifi-nar-bundles/nifi-confluent-platform-bundle/nifi-confluent-schema-registry-service/src/main/java/org/apache/nifi/confluent/schemaregistry/client/RestSchemaRegistryClient.java
+++ b/nifi-nar-bundles/nifi-confluent-platform-bundle/nifi-confluent-schema-registry-service/src/main/java/org/apache/nifi/confluent/schemaregistry/client/RestSchemaRegistryClient.java
@@ -194,14 +194,16 @@ public class RestSchemaRegistryClient implements SchemaRegistryClient {
}
}
+ // At this point, we could not get a subject/version associated to the schema and its ID
+ // we add the schema and its ID in the cache without a subject/version
if(completeSchema == null) {
- throw new SchemaNotFoundException("Could not get schema with id: " + schemaId);
+ return createRecordSchema(null, null, schemaId, schemaJson.get(SCHEMA_TEXT_FIELD_NAME).asText());
}
return createRecordSchema(completeSchema);
}
- private RecordSchema createRecordSchema(final String name, final int version, final int id, final String schema) throws SchemaNotFoundException {
+ private RecordSchema createRecordSchema(final String name, final Integer version, final int id, final String schema) throws SchemaNotFoundException {
try {
final Schema avroSchema = new Schema.Parser().parse(schema);
final SchemaIdentifier schemaId = SchemaIdentifier.builder().name(name).id((long) id).version(version).build();