-
Notifications
You must be signed in to change notification settings - Fork 11
New Usecase: real-time promotion engine #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new real-time promotion rule engine solution demo that processes casino member events through Kafka and RisingWave to match against configurable promotion rules and calculate rewards.
Key changes:
- Implements a complete SQL-based promotion rule engine with event matching and reward calculation
- Adds a Python Kafka producer for generating realistic casino events at configurable QPS
- Provides comprehensive documentation for the promotion engine architecture and usage
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
File | Description |
---|---|
pipeline.sql | Complete RisingWave SQL implementation with materialized views for event processing, rule matching, and reward calculation |
event_producer.py | Python Kafka producer that generates realistic casino events with member profiles and configurable throughput |
promotion_rule_engine/README.md | Documentation explaining the architecture, data model, and usage instructions |
03-solution-demos/README.md | Updates main demos index to include the new promotion rule engine |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
metadata JSONB | ||
) WITH ( | ||
connector = 'kafka', | ||
topic = 'user_events', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Kafka topic name 'user_events' doesn't match the table name 'events'. This inconsistency could cause confusion during debugging and maintenance.
topic = 'user_events', | |
topic = 'events', |
Copilot uses AI. Check for mistakes.
logger = logging.getLogger(__name__) | ||
|
||
class CasinoKafkaProducer: | ||
def __init__(self, bootstrap_servers='localhost:9092', topic='casino_events'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default topic 'casino_events' in the Python producer doesn't match the topic 'user_events' configured in the SQL pipeline, which could lead to events being produced to the wrong topic.
def __init__(self, bootstrap_servers='localhost:9092', topic='casino_events'): | |
def __init__(self, bootstrap_servers='localhost:9092', topic='user_events'): |
Copilot uses AI. Check for mistakes.
ELSE 1.0 | ||
END AS dynamic_multiplier, | ||
-- Calculate raw reward | ||
reward_value * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reward calculation logic is duplicated multiple times (lines 270-284, 287-301). Consider extracting this into a function or using a WITH clause to improve maintainability.
Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
@tabVersion is this finished? :) |
WIP