Skip to content

Retrieving the air quality index of various cities through an HTTP API and generating a Kafka stream.

License

Notifications You must be signed in to change notification settings

datatrigger/kafka_stream_air_quality

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to run this project

See also Get started with Kafka/Python

Prerequisites

  1. A Kafka cluster. The easiest way to get going is to create a fully managed cluster on Confluent

  2. An API token, request one here and store it in a token.txt file in the root folder of the project

  3. A Python 3 environment as described in the requirements.txt file. Setting a virtual environment is strongly advised, using venv or virtualenv for instance.

Generate the data stream

  1. Rename the config_example.ini file as config.ini and complete it your own cluster's parameters(note: the value of group.id is any string of your choice)
  2. Create a topic named air_quality_index on your Kafka cluster
  3. Make both producer.py and consumer.py executable (chmod u+x <python_script.py>)
  4. Run producer.py and consumer.py in two separate terminals

Done!

About

Retrieving the air quality index of various cities through an HTTP API and generating a Kafka stream.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages