Creating a Python microservice tier in four sprints using Cassandra, Kafka, and DSE Graph. The document outlines the steps taken in each sprint: Sprint 1 focused on setting up the basic plumbing of services, Sprint 2 added data access and business logic using Cassandra and DSE Search, Sprint 3 implemented messaging with Kafka, and Sprint 4 developed a graph-based recommender system using DSE Graph. Key lessons learned included decoupling components, using different driver interaction methods, and approaching new technologies incrementally.
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Creating a Python Microservice Tier in Four Sprints with Cassandra, Kafka, and DSE Graph
1. Creating a Python Microservice
Tier in Four Sprints with
Cassandra, Kafka, and DSE
Graph
Jeff Carpenter, Director of Developer Advocacy, DataStax
community.datastax.com | @jscarp
21. User Management Service – Protobuf service definition
https://github.com/KillrVideo/killrvideo-service-protos/blob/master/src/user-management/user_management_service.proto
35. Initializing DSE Driver and Mapper (__init__.py)
https://github.com/KillrVideo/killrvideo-python/blob/master/killrvideo/__init__.py
36. Video Catalog Service – Creating Prepared Statements
https://github.com/KillrVideo/killrvideo-python/blob/master/killrvideo/video_catalog/video_catalog_service.py
37. Video Catalog Service - Model classes used with Mapper
https://github.com/KillrVideo/killrvideo-python/blob/master/killrvideo/video_catalog/video_catalog_service.py
38. Video Catalog Service – adding a video
https://github.com/KillrVideo/killrvideo-python/blob/master/killrvideo/video_catalog/video_catalog_service.py
39. Video Catalog Service - Retrieving Latest Videos (paging)
https://github.com/KillrVideo/killrvideo-python/blob/master/killrvideo/video_catalog/video_catalog_service.py
50. Video Catalog Service – Producing YouTubeVideoAdded
https://github.com/KillrVideo/killrvideo-python/blob/master/killrvideo/video_catalog/video_catalog_events_kafka.py
51. Suggested Video Service – Consuming Events
https://github.com/KillrVideo/killrvideo-python/blob/master/killrvideo/suggested_videos/suggested_videos_events_kafka.py
So what is behind the system
We built a microservice application
So what is behind the system
We built a microservice application
So what is behind the system
We built a microservice application
So what is behind the system
We built a microservice application
So what is behind the system
We built a microservice application
So what is behind the system
We built a microservice application
Sometimes you just need to get out of the blocks
And now a comment about monorepos
You’ll notice in this presentation that code snips I share are from different repos within the KV org
If we were starting over, we might have done a monorepo
So what is behind the system
We built a microservice application
contradiction
The second sprint was the easy part – adding Cassandra
What is KillrVideo?
Theres an additional table for latest videos
So what is behind the system
We built a microservice application
I thought this might be a separate sprint, but turned out to be simple
I’ve abstracted the paging details for simplicity
So what is behind the system
We built a microservice application
In the third sprint I tacked a new challenge - Kafka
Multiple patterns exist for integrating Kafka and Cassandra – this is just one – using Kafka as a message bus between services.
For the last sprint I had a little help from my friends
Deliberately used the most complex insert example
Single traversal but multiple concatenated steps
Locate user, add video, user to video, add tags, video to tag