Skip to content

This is a final project of Streaming programming with Scala at UCU

License

Notifications You must be signed in to change notification settings

AlexanderOnbysh/streaming-programming-project

Repository files navigation

S𝘤à𝑙ẫ streaming programming final pr💡ject

by 🅐🅛🅔🅧🅐🅝🅓🅔🅡 🅞🅝🅑🅨🅢🅗

Build Status Build Status Build Status Build Status

This is a final project of Streaming programming with Scala at UCU. The aim of this project is to develop services for streaming data to Kafka topics then combine them using Kafka stream join.

𝑰dea 💭

The idea of the project is to get real stream of tweets and stock prices for given stock symbols, join them by symbol and forward to another Kafka topic for future processing.

Diagram shows rough architecture:
diagram

ℙroject 𝕊tructure

twitter-service - services gets real time stream of tweets with given keywords, all messages go to kafka tweets topic.
stocks-service - services gets real time stocks prices from IEX by given stock symbols, all prices go to kafka stocks topic.
combiner-service - service pulls messages from tweets and stocks, join them by stock symbol and sends to enriched topic.

𝕊etup 𝚕ocal 🅺afka 𝔠luster

This command will start zookeeper and kafka clusters. Default port is 9092.

make kafka-start

Shut down cluster:

make kafka-stop

𝕊etup 𝓼ervices 🛰

  1. Create stocks-credentials.env
TOKEN=sk_0000000000000000000000000

Token should be requested from IEX

  1. Create twitter-credentials.env
ACCESS_TOKEN_SECRET=
ACCESS_TOKEN=
CONSUMER_SECRET=
CONSUMER_KEY=

Credentials should be requested from Twitter Developer

  1. Create topics in Kafka
make kafka-create-topics
  1. Run services
make services-start

# to stop
make services-stop

𝐕iew 𝓂essages ⅰn 🅺afka ᵗopics 📬

  1. Install kaf tool github
make install-kaf
  1. View topics
kaf topics
  1. View topic's messages
kaf consume tweets
kaf consume stocks
kaf consume combined

Build 𝒾mages 📦

All images are build automatically from master branch by DockerHub:

  • alexanderonbysh/twitter-service:latest
  • alexanderonbysh/stocks-service:latest
  • alexanderonbysh/combiner-service:latest

If you want to update code just rebuild docker image:

cd twitter-service
docker build -t twitter-service .

𝔑otes 📝

Ẅhat 𝗖ould 𝘣e 🄘mproved 🚀

  • move data object like Tweet, Price, EnrichedTweet to common package 🙊
  • handle rate limits for Tweeter and IEX API endpoints 🙉
  • Tests 🙈

About

This is a final project of Streaming programming with Scala at UCU

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published