Team Created
[todo]
Overview
The Team Created event is triggered whenever a new team is created within the system. This event ensures that all parts of the system that rely on team data are kept up-to-date with the latest team information.
Architecture diagram
Payload example
Event example you my see being published.
{ "Name": "John Doe", "Age": 30, "Department": "Engineering", "Position": "Software Engineer", "Salary": 85000.5, "JoinDate": "2024-01-15"}Schema (avro)
{ "type" : "record", "namespace" : "Tutorialspoint", "name" : "Employee", "fields" : [ { "name" : "Name", "type" : "string" }, { "name" : "Age", "type" : "int" }, { "name" : "Department", "type" : "string" }, { "name" : "Position", "type" : "string" }, { "name" : "Salary", "type" : "double" }, { "name" : "JoinDate", "type" : "string", "logicalType": "date" } ]}Producing the Event
To produce an Inventory Adjusted event, use the following example Kafka producer configuration in Python:
from kafka import KafkaProducerimport jsonfrom datetime import datetime
# Kafka configurationproducer = KafkaProducer( bootstrap_servers=['localhost:9092'], value_serializer=lambda v: json.dumps(v).encode('utf-8'))
# Event dataevent_data = { "event_id": "abc123", "timestamp": datetime.utcnow().isoformat() + 'Z', "product_id": "prod987", "adjusted_quantity": 10, "new_quantity": 150, "adjustment_reason": "restock", "adjusted_by": "user123"}
# Send event to Kafka topicproducer.send('inventory.adjusted', event_data)producer.flush()Consuming the Event
To consume an Inventory Adjusted event, use the following example Kafka consumer configuration in Python:
from kafka import KafkaConsumerimport json
# Kafka configurationconsumer = KafkaConsumer( 'inventory.adjusted', bootstrap_servers=['localhost:9092'], auto_offset_reset='earliest', enable_auto_commit=True, group_id='inventory_group', value_serializer=lambda v: json.dumps(v).encode('utf-8'))
# Consume eventsfor message in consumer: event_data = json.loads(message.value) print(f"Received Inventory Adjusted event: {event_data}")JSON Schema
A record representing an employee
The name of the employee
The age of the employee
The department where the employee works
The position or title of the employee within the department
The salary of the employee
The date when the employee joined the company