JavaStandalone

Credit card fraud detection with OKafka

Score OKafka credit-card charge events with relational history, Oracle Spatial distance, and Oracle AI Vector Search behavior profiles.

Vector SearchJSONSpatialTxEventQTestcontainersKafka#Java#JSON#OKafka#Spatial#Testcontainers#TxEventQ#Vector Search
What this sample helps you learn

This sample consumes JSON card-charge events from an OKafka `CARD_CHARGES` topic and persists an explainable fraud assessment in Oracle AI Database. It is deliberately a deterministic teaching example, not a production fraud model.

What this sample demonstrates

Vector Search

Store embeddings and search records by semantic similarity.

Use when users search by meaning or AI answers need grounded records.

JSON

Document-shaped data and SQL/JSON querying inside Oracle AI Database.

Use when records need flexible structure without leaving SQL, indexes, constraints, and transactions.

Spatial

Location-aware storage, indexing, and spatial queries over geometry data.

Use when products ask about proximity, containment, routing, zones, or other location behavior.

TxEventQ

Transactional queues for database-backed events and messaging.

Use when event delivery and data changes need the same transaction boundary.

Testcontainers

Disposable Oracle AI Database Free containers for repeatable local and integration tests.

Use when tests need real database behavior without sharing a long-lived development instance.

Kafka

Kafka-compatible eventing and migration paths backed by Oracle AI Database queues.

Use when comparing separate-broker designs or moving Kafka-shaped workloads toward database-native eventing.

Highlights

  • Spatial: distance from the cardholder's most recent approved charge during the previous two hours.
  • Behavior: cosine distance from the closest VECTOR(384, FLOAT32) cardholder profile.
  • Amount: increase over the cardholder's normal amount.
  • Velocity: charge count in the previous fifteen minutes.