public void RetrieveSchemaId() { string groupName = TestEnvironment.SchemaRegistryGroup; #region Snippet:SchemaRegistryRetrieveSchemaId string schemaName = "employeeSample"; SerializationType schemaType = SerializationType.Avro; // Example schema's content string schemaContent = @" { ""type"" : ""record"", ""namespace"" : ""TestSchema"", ""name"" : ""Employee"", ""fields"" : [ { ""name"" : ""Name"" , ""type"" : ""string"" }, { ""name"" : ""Age"", ""type"" : ""int"" } ] }"; Response <SchemaProperties> schemaProperties = client.GetSchemaId(groupName, schemaName, schemaType, schemaContent); string schemaId = schemaProperties.Value.Id; #endregion Assert.AreEqual(_schemaProperties.Id, schemaId); }
private string GetSchemaId(Schema schema, CancellationToken cancellationToken) { var schemaProperties = _options.AutoRegisterSchemas ? _client.RegisterSchema(_groupName, schema.Fullname, SerializationType.Avro, schema.ToString(), cancellationToken) : _client.GetSchemaId(_groupName, schema.Fullname, SerializationType.Avro, schema.ToString(), cancellationToken); return(schemaProperties.Value.Id); }
public void RetrieveSchemaId() { var client = new SchemaRegistryClient(TestEnvironment.SchemaRegistryUri, TestEnvironment.Credential); #region Snippet:SchemaRegistryRetrieveSchemaId string schemaName = "<schema_name>"; string groupName = "<schema_group_name>"; SerializationType schemaType = SerializationType.Avro; // Example schema's content string schemaContent = @" { ""type"" : ""record"", ""namespace"" : ""TestSchema"", ""name"" : ""Employee"", ""fields"" : [ { ""name"" : ""Name"" , ""type"" : ""string"" }, { ""name"" : ""Age"", ""type"" : ""int"" } ] }"; Response <SchemaProperties> schemaProperties = client.GetSchemaId(groupName, schemaName, schemaType, schemaContent); string schemaId = schemaProperties.Value.Id; #endregion }