lib/avro_turf/messaging.rb in avro_turf-1.3.0 vs lib/avro_turf/messaging.rb in avro_turf-1.3.1
- old
+ new
@@ -122,11 +122,11 @@
# The actual message comes last.
writer.write(message, encoder)
stream.string
- rescue Excon::Error::NotFound
+ rescue Excon::Errors::NotFound
if schema_id
raise SchemaNotFoundError.new("Schema with id: #{schema_id} is not found on registry")
else
raise SchemaNotFoundError.new("Schema with subject: `#{subject}` version: `#{version}` is not found on registry")
end
@@ -192,11 +192,13 @@
[schema, schema_id]
end
# Fetch the schema from registry with the provided schema_id.
def fetch_schema_by_id(schema_id)
- schema_json = @registry.fetch(schema_id)
- schema = Avro::Schema.parse(schema_json)
+ schema = @schemas_by_id.fetch(schema_id) do
+ schema_json = @registry.fetch(schema_id)
+ Avro::Schema.parse(schema_json)
+ end
[schema, schema_id]
end
# Schemas are registered under the full name of the top level Avro record
# type, or `subject` if it's provided.