Skip to content
2024 Kaufland e-commerce · Software & data

Building a live price alerting pipeline

A streaming Apache Beam pipeline with a Redis cache that checks every price update against thresholds and alerts in Slack, for less than the batch job it replaced.

Context
Kaufland e-commerce, data platform
Role
Data Engineer
When
2024
Reference data is copied from BigQuery to Redis, so the pipeline never queries BigQuery per price update. Price updates to Core pipeline; Sold units to Core pipeline; Blocklists to Cache pipeline; Cache pipeline to Redis; Thresholds to Redis (export); Redis to Core pipeline (lookups); Core pipeline to Slack; Core pipeline to BigQuery export lookups Price updates Kafka Sold units Kafka Blocklists Kafka CDC Thresholds BigQuery Core pipeline Beam · Dataflow Cache pipeline Beam Redis cache Slack alerts BigQuery errors table
Reference data is copied from BigQuery to Redis, so the pipeline never queries BigQuery per price update.

The situation

On a marketplace, sellers update their prices all the time. Sometimes a price is wrong, a missing digit for example, and the item can sell far below its real price before anyone notices.

The goal was to catch price errors as soon as they happen.

How it works

The solution is a streaming pipeline built with Apache Beam and running on Google Dataflow. It does the same checks as the batch job, but on each price update as it arrives.

It has three parts:

The thresholds and the data used to filter false positives (like whitelisted prices, running campaigns, etc.) live in BigQuery. Querying BigQuery for every price update would be expensive, since it’s built for analytics, not for lookups. So every time one of these tables is updated, a scheduled task exports it to Redis, and the pipeline only reads from Redis.

The result

A wrong price is flagged as soon as the update arrives, day and night. The errors was also published to a topic, so other teams can use them, and the same setup can be reused for other real-time checks.