@Override public final O serialize(I input, SchemaMetadata schemaMetadata) throws SerDesException { ensureInitialized(); // compute schema based on input object String schema = getSchemaText(input); // register that schema and get the version try { SchemaIdVersion schemaIdVersion = schemaRegistryClient.addSchemaVersion(schemaMetadata, new SchemaVersion(schema, "Schema registered by serializer:" + this.getClass())); // write the version and given object to the output return doSerialize(input, schemaIdVersion); } catch (SchemaNotFoundException | IncompatibleSchemaException | InvalidSchemaException | SchemaBranchNotFoundException e) { throw new RegistryException(e); } }