This library provides a sink class to local file system that is used for the schema registry.
Package | Download | Version |
---|---|---|
Aliencube.AzureMessaging.SchemaRegistry.Sinks.FileSystem |
As an extension of ISchemaSink
and SchemaSink
respectively, both IFileSystemSchemaSink
and FileSystemSchemaSink
declare extra properties:
Directory
: Gets or sets theIDirectoryWrapper
instance. Default isDirectoryWrapper
.File
: Gets or sets theIFileWrapper
instance. Default isFileWrapper
.Encoding
: Gets or sets the file encoding. Default isEncoding.UTF8
.
It also has two overriding methods, GetSchemaAsync(string path)
and SetSchemaAsync(string schema, string path)
.
var location = "/etc/schema-registry/";
var sink = new FileSystemSchemaSink()
.WithBaseLocation(location);
var schema = "{" +
" \"type\": \"object\"," +
" \"properties\": {" +
" \"hello\": {" +
" \"type\": \"string\"" +
" }" +
" }" +
"}";
var path = "v1/schema.json";
var sinked = await sink.SetSchemaAsync(schema, path)
.ConfigureAwait(false);
var schema = await sink.GetSchemaAsync(path)
.ConfigureAwait(false);