All case studies

Hospitality & Loyalty Systems

Loyalty Pricing Engine

Built Spring Boot consumers for Kafka and ActiveMQ and Python Lambdas that calculate and publish nightly loyalty point prices for every hotel.

Role
Senior Java Backend Developer
Period
Jun 2022 — Mar 2026
Impact
Automated nightly loyalty point pricing for every hotel, with analysts managing the rules instead of the calculations.
Stack
  • Java
  • Spring Boot
  • Python
  • Kafka
  • ActiveMQ
  • AWS Lambda
  • AWS SNS
How a night's prices are calculated
How a night's prices are calculated. 1. Forecast and hotel data to Consumers: Publish forecasts (Kafka) and hotel changes (ActiveMQ). 2. Consumers to Pricing manager: Pass on only the data pricing needs. 3. Pricing manager to Pricing database: Stores forecasts and hotel data. 4. Scheduler functions to Pricing manager: A timed trigger creates the nightly batch. 5. Pricing manager to Scheduler functions: Announces the batch is ready to process. 6. Scheduler functions to Pricing manager: Begins the price calculations. 7. Pricing manager to Price decisions: Publishes the nightly price decisions.How a night's prices are calculated. 1. Forecast and hotel data to Consumers: Publish forecasts (Kafka) and hotel changes (ActiveMQ). 2. Consumers to Pricing manager: Pass on only the data pricing needs. 3. Pricing manager to Pricing database: Stores forecasts and hotel data. 4. Scheduler functions to Pricing manager: A timed trigger creates the nightly batch. 5. Pricing manager to Scheduler functions: Announces the batch is ready to process. 6. Scheduler functions to Pricing manager: Begins the price calculations. 7. Pricing manager to Price decisions: Publishes the nightly price decisions.

Problem

Loyalty analysts decide how many points a hotel room costs each night, and the right price depends on demand, which changes constantly. Doing that by hand for every hotel does not scale. The inputs also come from several upstream systems that publish in different ways: forecast rates and occupancy over Kafka, and hotel configuration changes over ActiveMQ.

The goal was a backend that takes in those inputs, applies the business rules analysts configure, and publishes a points price for every room category of every hotel each night.

System Architecture

Small services, each with one job. Spring Boot consumers read from Kafka and ActiveMQ, a pricing manager stores the data and runs the nightly calculation, and Python Lambda functions start the work on a schedule. The flow above is a simplified illustration of that shape.

  • Consumers for two brokers. Spring Boot services read forecast data from Kafka and hotel changes from ActiveMQ, keep only what pricing needs and pass it to the manager’s API.
  • One pricing manager. A Spring Boot service stores the data, holds the rules analysts configure (defaults, per-hotel settings and overrides) and calculates the points price for each room category, each night.
  • Serverless starters. A timed Lambda creates each night’s batch, and a second one, triggered through SNS, tells the manager to process it, so there is no always-on scheduler to run.
  • Published results. Price decisions are published as events for other systems to consume.

Trade-offs

  • Many small services over one application. Each consumer and starter can change and scale on its own, at the cost of more moving parts to deploy and monitor.
  • Two brokers, one model. Supporting both Kafka and ActiveMQ let upstream systems keep publishing the way they already did, at the cost of two client libraries and two failure modes.
  • A nightly batch over pricing on every event. Calculating once a night keeps results consistent and easy to audit, in exchange for prices that are only as fresh as the last batch.
  • Serverless starters over a scheduler inside the service. There is nothing always-on to run, but the timing and call sequence live outside the manager and have to be monitored there.

Measurable Impact

  • Loyalty point prices are calculated and published every night for each hotel’s room categories, without manual steps.
  • Loyalty analysts configure rules, overrides and alerts themselves instead of requesting pricing changes from engineering.

Working on a similar system?

Tell me about the constraints and I'll reply with how I'd approach it.