コード例 #1
0
        public void RetrieveSchema()
        {
            var client = new SchemaRegistryClient(TestEnvironment.SchemaRegistryUri, TestEnvironment.Credential);

            #region Snippet:SchemaRegistryRetrieveSchema
            string schemaId = "<schema_id>";

            Response <SchemaProperties> schemaProperties = client.GetSchema(schemaId);
            string schemaContent = schemaProperties.Value.Content;
            #endregion
        }
コード例 #2
0
        public void RetrieveSchema()
        {
            var schemaId = _schemaProperties.Id;

            #region Snippet:SchemaRegistryRetrieveSchema
            SchemaRegistrySchema schema = client.GetSchema(schemaId);
            string content = schema.Content;
            #endregion

            Assert.AreEqual(Regex.Replace(_content, @"\s+", string.Empty), content);
        }
コード例 #3
0
        public void RetrieveSchema()
        {
            var schemaId = _schemaProperties.Id;

            #region Snippet:SchemaRegistryRetrieveSchema
            SchemaRegistrySchema schema = client.GetSchema(schemaId);
            string definition           = schema.Definition;
            #endregion

            Assert.AreEqual(Regex.Replace(_definition, @"\s+", string.Empty), definition);
        }
コード例 #4
0
        public void RetrieveSchema()
        {
            var schemaId = _schemaProperties.Id;

            #region Snippet:SchemaRegistryRetrieveSchema
            Response <SchemaProperties> schemaProperties = client.GetSchema(schemaId);
            string schemaContent = schemaProperties.Value.Content;
            #endregion

            Assert.AreEqual(Regex.Replace(_schemaProperties.Content, @"\s+", string.Empty), schemaContent);
        }
        private Schema GetSchemaById(string schemaId, CancellationToken cancellationToken)
        {
            if (_cachedSchemas.TryGetValue(schemaId, out var cachedSchema))
            {
                return(cachedSchema);
            }

            var schemaContent = _client.GetSchema(schemaId, cancellationToken).Value.Content;
            var schema        = Schema.Parse(schemaContent);

            _cachedSchemas.Add(schemaId, schema);
            return(schema);
        }
コード例 #6
0
        private async Task <Schema> GetSchemaByIdAsync(string schemaId, bool async, CancellationToken cancellationToken)
        {
            if (_cachedSchemas.TryGetValue(schemaId, out Schema cachedSchema))
            {
                return(cachedSchema);
            }

            string schemaContent;

            if (async)
            {
                schemaContent = (await _client.GetSchemaAsync(schemaId, cancellationToken).ConfigureAwait(false)).Content;
            }
            else
            {
                schemaContent = _client.GetSchema(schemaId, cancellationToken).Content;
            }
            var schema = Schema.Parse(schemaContent);

            _cachedSchemas.Add(schemaId, schema);
            return(schema);
        }