Inventory adjusted (Changelog)
Indicates a change in inventory level
Event
-
2024-08-01 (latest)
⭐️ JSON SchemaAdded support for JSON Schema
InventoryAdjusted uses Avro but now also supports JSON Draft 7.
Employee JSON Draft // labeled-line-markers.jsx{"$schema": "http://json-schema.org/draft-07/schema#","type": "object","title": "Employee","properties": {"Name": {"type": "string"},"Age": {"type": "integer"},"Town": {"type": "string"}},"required": ["Name", "Age", "Town"]}Using it with our Kafka Cluster
1. Create a new topic
Terminal window # Create a topic named 'employee_topic'kafka-topics.sh --create --topic employee_topic --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1Step 2: Prepare the JSON Message
Create a JSON file named
employee.json
with the following content:{"Name": "John Doe","Age": 30,"Town": "Springfield"}Step 3: Produce the Message to Kafka Topic
Use the Kafka producer CLI to send the JSON message:
Terminal window cat employee.json | kafka-console-producer.sh --topic employee_topic --bootstrap-server localhost:9092Step 4: Verify the Message (Optional)
Terminal window kafka-console-consumer.sh --topic employee_topic --from-beginning --bootstrap-server localhost:9092schema.avro CHANGED@@ -2,9 +2,12 @@2 "type" : "record",3 "namespace" : "Tutorialspoint",4 "name" : "Employee",5 "fields" : [6 - { "name" : "Name"7 - { "name" : "Age"
8 - { "name" : "Town"
9 ]10 - }2 "type" : "record",3 "namespace" : "Tutorialspoint",4 "name" : "Employee",5 "fields" : [6 + { "name" : "Name", "type" : "string" },7 + { "name" : "Age", "type" : "int" },8 + { "name" : "Department", "type" : "string" },9 + { "name" : "Position", "type" : "string" },10 + { "name" : "Salary", "type" : "double" },11 + { "name" : "JoinDate", "type" : "string", "logicalType": "date" }12 ]13 + } -
2024-07-11
New fieldAdded new field to schema
We added the new town property to the schema for downstream consumers.
// labeled-line-markers.jsx{"type" : "record","namespace" : "Tutorialspoint","name" : "Employee","fields" : [{ "name" : "Name" , "type" : "string" },{ "name" : "Age" , "type" : "int" },{ "name" : "Town" , "type" : "string" },]} -
2024-07-01
Breaking changeRemoved fields from schema, added new owners
Gender
property has been removed from the Schema of the eventAlso added the full stackers team as owners of this event
{"type" : "record","namespace" : "Tutorialspoint","name" : "Employee","fields" : [{ "name" : "Name" , "type" : "string" },{ "name" : "Age" , "type" : "int" },{ "name" : "Gender" , "type" : "string" },]}