README.md in avro_turf-0.9.0 vs README.md in avro_turf-0.10.0
- old
+ new
@@ -124,16 +124,30 @@
# time a schema is used.
data = avro.encode({ "title" => "hello, world" }, schema_name: "greeting")
# If you don't want to automatically register new schemas, you can pass explicitly
# subject and version to specify which schema should be used for encoding.
-# It will fetch that schema from the registry and cache it. Subsequent instances
+# It will fetch that schema from the registry and cache it. Subsequent instances
# of the same schema version will be served by the cache.
data = avro.encode({ "title" => "hello, world" }, subject: 'greeting', version: 1)
+# You can also pass explicitly schema_id to specify which schema
+# should be used for encoding.
+# It will fetch that schema from the registry and cache it. Subsequent instances
+# of the same schema version will be served by the cache.
+data = avro.encode({ "title" => "hello, world" }, schema_id: 2)
+
# When decoding, the schema will be fetched from the registry and cached. Subsequent
# instances of the same schema id will be served by the cache.
avro.decode(data) #=> { "title" => "hello, world" }
+
+# If you want to get decoded message as well as the schema used to encode the message,
+# you can use `#decode_message` method.
+result = avro.decode_message(data)
+result.message #=> { "title" => "hello, world" }
+result.schema_id #=> 3
+result.writer_schema #=> #<Avro::Schema: ...>
+result.reader_schema #=> nil
```
### Confluent Schema Registry Client
The ConfluentSchemaRegistry client used by the Messaging API can also be used directly.