Scrivio Interview library
LeadershipPrincipal6 min read · updated 13 November 2026

The business wants a real-time revenue dashboard built from Kafka events and expects it to match finance's end-of-day figures exactly. Some events arrive days late from offline stores, refunds and corrections arrive as separate events, and regions close their day in different time zones.

As the senior engineer accountable for it, how do you set expectations and choose the architecture?

I would make the trade-off explicit: the streaming figure is provisional and converges, while finance's figure is closed with cut-off rules, so we agree what the dashboard promises and show its status. We define time with finance, business date by regional time zone and where late events go, and build two paths that share one definition of revenue: a streaming view with grace periods and corrections, and a batch job that produces the authoritative daily figure, reconciled automatically. Designs are correctable and replayable, and governance has named owners.

Why this question is asked

Exact real-time numbers that match finance is a promise a streaming system cannot make on its own, and a senior engineer who accepts it silently sets the project up to fail. Late events, refunds and time zones all mean the live figure will differ from the closed books for a while. Interviewers ask this to see how we set expectations, design for corrections and keep business definitions consistent. In this answer, we will explain why exact real time is impossible, agree the promise, define time with finance, design the two paths, make the design correctable, and set up governance.

1Why Exact Real Time Is Not Possible Here

A real-time figure can only count what has arrived. Offline stores send sales days late, refunds arrive as separate events after the sale, and corrections change earlier records. Finance's end-of-day figure, by contrast, is produced after a cut-off: they wait for the day to close in each region, apply rules about what belongs to which day, and then freeze the number. Those are two different kinds of number, a provisional one that converges and a closed one, and treating them as the same guarantees a dispute after every late batch.

So the first job is not technical. It is to make the business see that trade-off and agree on what each number means.

2Agreeing What the Dashboard Promises

We write down a promise that can be measured, for example: the live figure is within 0.5 percent of the final figure 15 minutes after the fact, and exactly equal after the daily close of that region. The dashboard shows the status of every number, provisional or closed, with the time of the last close, so nobody presents a provisional figure as final in a board meeting.

Then we measure the promise, using history: replay last quarter's events, compute what the live figure would have shown at each moment, and compare with finance's closed figures. If 0.5 percent is not achievable because one region's stores upload weekly, we learn it before launch.

3Defining Time With Finance

Time has to be defined precisely and jointly. The business date of a sale is the date in the region's local time zone, so a sale at 23:30 in Los Angeles belongs to that day even though it is the next day in UTC; Kafka Streams' tumbling windows align to the UTC epoch, so we compute a business-date key per event rather than using daily windows. We use event time, when the sale happened, not processing time. And we agree where late events go: back into their original day if that day is not yet closed, and to an adjustment line on the current day if it is, the same rule finance applies to its books.

Rules agreed with finance
QuestionAgreed rule
Which day does a sale belong to?Business date in the region's local time zone
Which timestamp counts?Event time of the sale, not arrival time
Late sale for an open day?Added to its own day
Late sale for a closed day?Adjustment line on the current day
Refund or correction?Separate event, applied to the original sale's day

4Two Paths That Share One Definition

The architecture has two paths fed by the same events. The streaming path, for example Kafka Streams, aggregates revenue per region and business date with grace periods for normal lateness, and applies refunds and corrections as updates to the keyed aggregates. It serves the live dashboard. The batch path reads the full event history once a region's day closes and produces the authoritative daily figure.

Both paths use one shared library for the revenue definition: which event types count, how refunds net off, currency conversion rules. If each path implemented revenue separately, they would drift for reasons nobody could explain. An automatic reconciliation compares the two per region and day and alerts when drift exceeds the promise.

Step throughRevenue architecture
  1. DashboardShows figures with provisional or closed status
  2. Streaming pathKeyed aggregates per region and business date, upserted
  3. Batch closeAuthoritative daily figure after each region's cut-off
  4. ReconciliationCompares both paths, alerts on drift
  5. Shared revenue definitionOne library used by both paths
  6. Kafka topics with long retentionReplayable source of sales, refunds, corrections

6 layers, from the top down. Step through them one at a time.

5Designing for Corrections

Correctable designs beat append-only ones. Aggregates are keyed by region and business date and written to the sink with upserts, so a correction replaces a value rather than adding a second row. Topics keep enough retention, or are archived to object storage, so we can recompute any period after fixing a bug. Sinks are idempotent, so a replay does not double count. A running total that only ever adds would make every mistake permanent; a keyed aggregate that can be recomputed and overwritten makes mistakes fixable.

6Owning the Governance

Most disputes about numbers are disputes about definitions. So there is one written definition of revenue, owned jointly with finance, with tests against known datasets, such as a day with a refund, a late store upload and a cross-midnight sale, run on every change to either path. Each correction path, for late uploads, refunds and manual adjustments, has a named owner. When the figures disagree, the rules decide, not a debate after each incident.

7Follow-up questions

Would you ever let the streaming figure replace the batch one?

Possibly, once evidence supports it. If months of reconciliation show the streaming path matching the batch figure exactly after each close, the close itself could be produced by the streaming system, for example by recomputing a closed day from retained topics. But finance needs audit trails, frozen figures and controlled restatements, so the closed number would still be a separate, versioned output with its own process, even if the computation is shared.

How do you handle currency conversion in the live figure?

Use the same rate source and rule as finance, for example the daily rate for the business date, and mark live figures that used a provisional rate. Currency is a frequent source of unexplained drift.

What if the business insists on exact real-time figures?

Show them, with the replay data, how far the live figure was from the closed figure at different delays. Concrete examples from their own history usually turn the conversation from exact to good enough by when.

8Conclusion

In this answer, we saw that a live revenue figure is provisional and converges while finance's figure is closed after cut-off, so we agree a measurable promise and show each figure's status. We defined time with finance, business date by local time zone, event time and rules for late events, built a streaming path and a batch close that share one revenue definition and reconcile automatically, designed keyed, replayable and idempotent aggregates so corrections are possible, and gave every definition and correction path an owner.

What to say in the interviewAbout 90 seconds aloud

Open with

I would start by making the trade-off explicit with the business and finance. A streaming number is provisional: late store uploads, refunds and corrections keep changing it until it converges.

Then, if they want more

Finance's number is a closed-book figure with cut-off rules. So we agree on a measurable promise, for example within half a percent after fifteen minutes and exact after each region's daily close, test it by replaying past data, and show on the dashboard whether each figure is provisional or closed.

Then I would define time precisely with finance: business date in each region's local time zone, event time rather than processing time, and whether late events go back to their own day or to an adjustment line once the day is closed.

The architecture has two paths sharing one revenue definition: streaming aggregates keyed by region and business date with grace periods and upserts for corrections for the live view, and a batch job over the full history that produces the authoritative daily figure, with automatic reconciliation that alerts on drift.

I prefer correctable designs, keyed aggregates, replayable topics and idempotent sinks over append-only totals. And I would own governance: one written definition of revenue, tests on known datasets, and a named owner for every correction path, so disagreements are settled by rules.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Apache Kafka documentation
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "As the senior engineer accountable for it, how do you set expectations and choose the...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-streams-connect/8d5c149bf6/