Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Intelligence View
⚡ tsecurity.de Intelligence

How I'd Design a Kafka-Based Payment Event Pipeline from Scratch

Architecture walkthroughs tend to show you the polished version — the diagram that survived a whiteboard, cleaned up after the fact. What they skip is the sequence of decisions, tradeoffs, and dead ends that got there. That's what I want t…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Architecture walkthroughs tend to show you the polished version — the diagram that survived a whiteboard, cleaned up after the fact. What they skip is the sequence of decisions, tradeoffs, and dead ends that got there. That's what I want to share here, based on having built and operated Kafka-based payment pipelines at production scale in Brazilian fintech.






Start with Requirements, Not Technology



The first mistake teams make is starting with "we're going to use Kafka" before defining what correctness means for their payment events.



Key questions before drawing a single box:



What is the ordering requirement? Within a Kafka partition, ordering is guaranteed. Across partitions, it is not. If you need per-payment ordering (all events for a given payment ID in sequence), partition by payment ID and you get it for free.



What is your durability requirement? Kafka with acks=all and min.insync.replicas=2 is durable. For payment events, this is non-negotiable.



What is your latency requirement? Kafka adds latency — typically single-digit milliseconds for the publish path. If you need sub-millisecond authorization decisions, use Kafka for audit, reconciliation, and notifications; use a direct synchronous call for the authorization itself.






Topic Structure



Design topics around event lifecycle stages, not consumers:




payment.initiated       — customer submits payment intent
payment.authorized — auth decision from card network / PIX
payment.settled — funds confirmed settled
payment.failed — any terminal failure
payment.refund.initiated
payment.refund.settled






Why separate topics? Consumer groups subscribe at topic granularity. A reconciliation service only cares about settled events — it shouldn't filter through initiated events at volume. Separate topics allow independent scaling, retention policies, and consumer group management.



What I avoid: a single payment.events topic with a type field that consumers filter on. The fan-out cost is real at scale.






Partitioning Strategy



Partition by payment ID. Payment reconciliation requires that all events for a given payment arrive in order at the consumer. Partitioning by customer ID creates hot partitions for high-volume customers (merchants, corporate accounts).



Use hash(paymentId) % partitionCount to compute partition number.






Consumer Design



Every consumer must be idempotent. This needs to be stated explicitly because Kafka's exactly-once semantics does not make your consumers idempotent for external writes.




@KafkaListener(topics = "payment.authorized")
@Transactional
public void handleAuthorized(PaymentAuthorizedEvent event) {
// Idempotency check — unique constraint on event_id handles races
if (paymentRepository.existsByEventId(event.getEventId())) {
return;
}

Payment payment = paymentRepository.findByPaymentId(event.getPaymentId())
.orElseThrow();
payment.authorize(event.getAuthCode(), event.getTimestamp());
paymentRepository.save(payment);

// Outbox entry in same transaction for downstream event
outboxRepository.save(new OutboxEntry(event.getEventId(), "payment.settled", ...));
}






The outbox entry ensures that the downstream event and the database state change are atomic.






Dead Letter Queue



Every consumer topic needs a corresponding dead letter topic:




payment.authorized.DLT
payment.settled.DLT






When a consumer throws an unrecoverable exception, the message routes to the DLT with error metadata appended. Do not retry poison messages indefinitely on the main topic — they stall the entire partition.



Instrument DLT queue depth as a critical metric. A growing DLT is an incident.






Schema Evolution



Payment event schemas change. Card networks add fields. PIX adds event types. Use Avro or Protobuf with a schema registry — both enforce backward/forward compatibility at publish time.



Mark all new fields as optional with defaults. Never remove fields from published schemas without a full migration plan for all consumers.






Monitoring That Matters




  • Consumer lag per partition — not just the sum, the distribution

  • Processing latency histogram (p50, p99, p999)

  • DLT queue depth per topic

  • Rebalance frequency and duration



Treat DLT depth and processing latency as paging metrics.






The Part Most Design Docs Skip



The hardest design decision isn't the technology choices — it's defining your payment state machine.



A payment can be initiated, pending authorization, authorized, settling, settled, failed, refunded, partially refunded, disputed. Not all transitions are valid. If you don't model this explicitly before building consumers, you'll encode the state machine implicitly in consumer logic — scattered, inconsistent, hard to audit.



The event pipeline is infrastructure. The state machine is the business logic. Get the business logic right first.






If you found this useful, I run 1:1 mentoring sessions for Java/backend engineers at topmate.io/aliasgar_kantawala



My Java interview guides and system design resources are at aliasgarmk.gumroad.com

1. Sofort-Triage & Abwehrmaßnahmen

SOC Incident Playbook: Remote Code Execution (RCE) Defense
1 Warnungen
title: Detect Exploitation - How I'd Design a Kafka-Based Payment Event Pipeline from Scratch
id: d79e674e-3711-443a-ac8b-ae6ae7cc53f9
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-26
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
Syntax validiert (0 Fehler)
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-26"
        description = "YARA Signature for "
    strings:
        $str = "How I\'d Design a Kafka-Based P" ascii wide
    condition:
        any of them
}
Syntax validiert (0 Fehler)
index=security sourcetype IN ("cisco:asa", "pan:traffic", "zeek_conn", "suricata", "WinEventLog:Security")
("How Id Design a Kafka-Based Payment Even")
| stats count earliest(_time) as first_seen latest(_time) as last_seen by src_ip, dest_ip, dest_host, signature
| eval first_seen=strftime(first_seen, "%Y-%m-%d %H:%M:%S"), last_seen=strftime(last_seen, "%Y-%m-%d %H:%M:%S")
| sort - count
Syntax validiert (0 Fehler)
message: "*How Id Design a Kafka-Based Payment Even*"
Syntax validiert (0 Fehler)
CommonSecurityLog
| where Message has "How Id Design a Kafka-Based Payment Even"
| summarize EventCount = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by SourceIP, DestinationIP, DestinationPort, Activity
| extend DetectionRule = "iShareStuff-CTI-Compiled"
| sort by EventCount desc

2. Cyber Threat Intelligence & Forensik

🎯
MITRE ATT&CK Matrix Navigator 14 Taktiken
Reconnaissance
-
Resource Development
-
Initial Access
Execution
Persistence
-
Privilege Escalation
Defense Evasion
Credential Access
-
Discovery
-
Lateral Movement
-
Collection
-
Command and Control
Exfiltration
-
Impact
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich How I'd Design a Kafka-Based Payment Eve.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

⚡ Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How I'd Design a Kafka-Based Payment Event Pipeline from Scratch

Thematisch verwandte Begriffe: Design, KafkaBased, Payment, Event · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-88003 | InvoicePlane is a self-hosted open source application for managing invoi…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag