Skip to content

Real-time transaction monitoring: a streaming architecture for banks

B2Bnetwork team · · 6 min

IT in banking

In brief

Real-time transaction monitoring means assessing each operation as it happens, not in an overnight batch run. A streaming architecture consists of event sources (payments, cards, logins), an event bus such as Apache Kafka, stateful processing that computes aggregates over time windows, scoring with rules and a model, and case management. The hard part is not the rules but state, event ordering, the time budget on the payment path, and how the system behaves when one of its components does not respond.

What "real time" means

In a bank, the same term describes three different modes. It is worth separating them before design starts, because they have different timing requirements and different consequences of error.

ModeWhen the decision is madeTypical useEffect of a delay
inlinebefore the operation is executed, in millisecondsfraud in instant transfers and card authorizationsthe payment waits or goes through unscored
near real timeseconds or minutes after the operationAML scenarios, alerts about unusual activitythe alert comes later, but the operation does not wait
batchonce a day or less oftenperiodic reviews, some reportsthe risk is detected the next day

The rules ask for different things. Delegated Regulation (EU) 2018/389 requires payment service providers to have transaction monitoring mechanisms that detect unauthorized and fraudulent payments. The Polish Anti-Money Laundering Act requires ongoing monitoring of business relationships. Regulation (EU) 2024/886 gives 10 seconds for the whole instant euro payment, and moves sanctions screening of customers to at least once a day. AML rules and thresholds are covered in AML and transaction monitoring, and fraud models in Payment fraud detection.

The architecture, layer by layer

  1. Event sources. The payment engine, card authorizations, online banking (logins, new devices, adding a payee), the core system. Events from older systems are captured from the database with change data capture, described in Change data capture.
  2. The event bus. Topics in Apache Kafka partitioned by key, usually the account or customer, with event schemas in a registry. A partition preserves the order of one customer's events.
  3. Stateful processing. Streaming applications (such as Apache Flink or Kafka Streams) join events with the customer profile and compute aggregates over time windows: the sum of transfers in the last hour, the number of new payees in a day, the first payment from a new device.
  4. Scoring. Rules and a model return a risk score with a reason. Rules catch known patterns, the model catches unusual behavior.
  5. Decision and cases. Inline: allow, hold for review, reject. In the other modes: an alert to an analyst with context in the case management system.
  6. The feedback loop. The analyst's outcome (fraud, false alarm) comes back as an event and feeds the tuning of rules and the model.

How Kafka itself works and when it pays off is covered in Apache Kafka in the enterprise.

State, time windows and event order

A rule like "more than 5 transfers to new payees within an hour" looks simple, but it needs three design decisions.

Event time or processing time. The window is computed by the time the operation happened, not the moment it reached the system. Otherwise a delay in one source changes the rule's result.

Late events. An event from the card system may arrive a few seconds after an event from online banking even though it happened earlier. You have to decide how long a window waits for late events and what happens to those that arrive after it closes.

Exactly once. After a failure, the application resumes processing from a saved checkpoint. Without transactional state writes and idempotent outputs, the same payment can be counted twice and falsely cross a threshold.

An example aggregate in Flink SQL: the count and sum of transfers per account in a one-hour window that slides every 5 minutes.

SELECT account_id, window_start, window_end,
       COUNT(*) AS transfers, SUM(amount) AS total
FROM TABLE(
  HOP(TABLE transfers, DESCRIPTOR(event_time),
      INTERVAL '5' MINUTES, INTERVAL '1' HOUR))
GROUP BY account_id, window_start, window_end;

The time budget and behavior on failure

In inline mode, monitoring is part of the payment path, so it gets a hard time budget measured at high percentiles, not the average, as explained in Percentiles instead of averages. Every failure needs a response agreed in advance:

SituationPossible responseWhat to watch
scoring does not answer within the time budgeta fallback decision: simpler local rules or an amount thresholdthe fallback decision must be recorded and counted in reports
a delay in one event sourcescoring on an incomplete profile, flagged as suchan alert to the team when the delay exceeds a threshold
a broker or streaming application failurefailover to a replica, resuming from a checkpointthe time needed to rebuild state after a restart
overload at peakflow control, priority for the inline pathAML alerts can wait, a payment cannot

The PSR package, not yet adopted as of November 30, 2026, is set under the agreement between Parliament and the Council to require the payee's bank to freeze a suspicious transaction. That moves part of monitoring onto incoming payments, as we describe in PSD3 and PSR.

How to test streaming monitoring

TestWhat it checks
historical replayan event stream from several months, with data masked, produces the same alerts as the current system, and differences are explained
shadow modethe new system scores production traffic in parallel with the old one but makes no decisions
performancescoring time at high percentiles under peak traffic and while state is rebuilt
failuresstopping a broker, restarting the application, a delayed source: is the result correct and is nothing counted twice
data qualitymissing fields, duplicate events, a schema change at the source

Historical replay and shadow mode are the condition for switching over: only when the differences between the old and new system are understood can the new system make decisions.

B2Bnetwork engineers design and build these flows as part of our System integration service: from the event map and contracts to contract tests and latency monitoring. A similar foundation is described in our case study on replacing an ESB with an event platform in payments.

Questions and answers

Do you need Kafka for real-time monitoring?

Not always, but with many event sources and several consumers (fraud, AML, analytics), an event bus simplifies the architecture: a source publishes an event once, and each system reads it at its own pace. With one source and simple rules, a rule engine called directly by the payment system is sometimes enough.

Can a machine learning model stop a payment on its own?

Technically yes, but the decision should combine the model with rules and thresholds set by the bank, and every hold should go to an analyst or to the customer with a way to confirm. A model that rejects payments on its own, without oversight or a reason, is hard to defend to a customer or an auditor.

How do you move from batch to streaming monitoring?

In stages. First, events from the sources go onto the bus alongside the existing batch runs. Then new rules run in shadow mode, and results are compared with the batch system. The switch happens for one operation type at a time, starting with the one where decision speed gives the most.

How much history should a streaming application keep in state?

As much as the longest windows in your rules require, with a margin for late events. Long customer behavior profiles, for example over several months, are better computed separately and fed into the stream as enrichment, because large state lengthens recovery after a failure.

What it looks like in a project

Working on banking systems? Talk to an engineer who knows their constraints.

Let's talk

Read more: IT in banking

All in IT in banking →