Skip to content

Latest commit

 

History

History
38 lines (34 loc) · 1.17 KB

README.md

File metadata and controls

38 lines (34 loc) · 1.17 KB

Generate Avro Messages To Kafka

Goals:

This script Python generates fake data as Avro format to Kafka. This script was developped for this tutorial :

Avro Schema:

{
    "namespace": "io.confluent.connect.avro",
    "type": "record",
    "name": "test_event_record_avro",
    "fields": [
        { "name": "visitorId", "type": "int"},
        { "name": "pageViewId", "type": "int"},
        { "name": "timestamp", "type": "int"},
        { "name": "referer", "type": "string"},
        { "name": "pageType", "type": "string"},
        { "name": "userAgent", "type": "string"},
        { "name": "device", "type": "int"},
        { "name": "locale", "type": "string"},
        { "name": "eventType", "type":"string","default": "unknown"}
    ]
} 

Configuration:

Please modify the file "generator.py", section Configuration

SCHEMA_REGISTRY_URL = 'http://schema.registry.com:8081'
TOPIC = 'test_event_record_avro'
KAFKA_SERVER_URL = 'kafka.url.com:9092'

Install requirements

$ pip install -r requirements.txt