Skip to content

jocelyndrean/generate_avro_message_to_kafka

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

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

About

Generate fake Avro data to a Kafka topic using Schema Registry

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages