Appearance
Data Flow Architecture
Understanding how data moves through the platform.
Core Data Flows
1. Participant Onboarding Flow
mermaid
sequenceDiagram
actor User
participant Portal as Operator Console
participant API as Real Estate API
participant KC as Keycloak
participant PG as PostgreSQL
participant EDC as EDC-V
participant Kafka as Kafka
User->>Portal: Submit organization details
Portal->>API: POST /organizations
API->>PG: Insert organization (pending)
API->>KC: Create organization realm/client
KC-->>API: Client credentials
API->>PG: Update organization with KC client_id
API->>Kafka: Publish OrganizationCreated event
API-->>Portal: Organization created (pending KYC)
User->>Portal: Submit KYC documents
Portal->>API: POST /kyc/records
API->>PG: Create KYC record
API->>Kafka: Publish KYCSubmitted event
API-->>Portal: KYC submitted for review
actor Reviewer
Reviewer->>Portal: Approve KYC
Portal->>API: PATCH /kyc/records/{id} (verified)
API->>PG: Update KYC status
API->>KC: Enable organization client
API->>Kafka: Publish KYCVerified event
User->>Portal: Create participant
Portal->>API: POST /participants
API->>PG: Create participant
API->>EDC: Create participant context
EDC->>EDC: Provision tenant, quotas, features
EDC-->>API: Context created (edc_tenant_id)
API->>PG: Create participant context
API->>Kafka: Publish ParticipantContextCreated
API-->>Portal: Participant ready2. Asset Publication Flow
mermaid
sequenceDiagram
actor Provider
participant API as Real Estate API
participant EDC as EDC-V
participant PG as PostgreSQL
participant MinIO as MinIO
participant Kafka as Kafka
participant ES as Elasticsearch
Provider->>API: POST /assets (with data address)
API->>PG: Create asset (draft)
API->>MinIO: Upload data file (if provided)
MinIO-->>API: Presigned URL / object ID
API->>PG: Update asset with data address
API->>EDC: Create asset in catalog
EDC->>EDC: Register in DSP catalog
EDC-->>API: Asset registered
API->>PG: Update asset status (published)
API->>Kafka: Publish AssetPublished event
API->>ES: Index asset for search
ES-->>API: Indexed
API-->>Provider: Asset published3. Contract Negotiation Flow (DSP)
mermaid
sequenceDiagram
actor Consumer
participant API_C as Consumer API
participant EDC_C as Consumer EDC-V
participant EDC_P as Provider EDC-V
participant API_P as Provider API
participant Kafka as Kafka
Consumer->>API_C: POST /contract-negotiations
API_C->>EDC_C: Initiate negotiation (DSP)
EDC_C->>EDC_P: ContractRequest (DSP protocol)
EDC_P->>API_P: Validate contract definition
API_P->>API_P: Check policy, quotas, availability
API_P-->>EDC_P: ContractOffer / Rejection
EDC_P->>EDC_C: ContractOffer (DSP protocol)
EDC_C->>API_C: Update negotiation state (OFFERED)
API_C->>Kafka: Publish NegotiationOffered
API_C-->>Consumer: Offer received
Consumer->>API_C: Accept offer
API_C->>EDC_C: Accept (DSP)
EDC_C->>EDC_P: Accepted (DSP)
EDC_P->>API_P: Create contract agreement
API_P->>API_P: Generate agreement ID, terms
API_P-->>EDC_P: Agreement created
EDC_P->>EDC_C: Agreement (DSP)
EDC_C->>API_C: Update state (AGREED)
API_C->>Kafka: Publish ContractAgreed
API_C-->>Consumer: Contract agreed4. Data Transfer Flow
mermaid
sequenceDiagram
actor Consumer
participant API_C as Consumer API
participant EDC_C as Consumer EDC-V
participant EDC_P as Provider EDC-V
participant API_P as Provider API
participant MinIO as MinIO
participant Kafka as Kafka
Consumer->>API_C: Start transfer (transfer process)
API_C->>EDC_C: Initiate transfer (DSP)
EDC_C->>EDC_P: TransferRequest (DSP)
EDC_P->>API_P: Validate agreement, generate data address
API_P->>MinIO: Generate presigned URL (if S3)
MinIO-->>API_P: Presigned URL (expires in 1h)
API_P-->>EDC_P: DataAddress with URL + auth
EDC_P->>EDC_C: TransferStart (DSP) with DataAddress
EDC_C->>API_C: Update transfer state (PROVISIONED)
API_C->>Kafka: Publish TransferProvisioned
Consumer->>MinIO: Download data (direct)
MinIO-->>Consumer: Data stream
Consumer->>API_C: Confirm completion
API_C->>EDC_C: TransferCompletion (DSP)
EDC_C->>EDC_P: TransferCompletion (DSP)
EDC_P->>API_P: Mark transfer completed
API_P->>Kafka: Publish TransferCompleted
API_C->>Kafka: Publish TransferCompleted
API_C-->>Consumer: Transfer complete5. Cross-Organization X-Road Flow
mermaid
sequenceDiagram
actor OrgA_User
participant API_A as Org A API
participant XRoad_A as Org A X-Road
participant XRoad_B as Org B X-Road
participant API_B as Org B API
OrgA_User->>API_A: Request data from Org B
API_A->>XRoad_A: Sign & encrypt request
XRoad_A->>XRoad_B: mTLS + X-Road protocol
Note over XRoad_A,XRoad_B: Security servers verify<br/>certificates, timestamps,<br/>message integrity
XRoad_B->>API_B: Decrypt & verify request
API_B->>API_B: Authorize (check rights)
API_B->>XRoad_B: Response (encrypted)
XRoad_B->>XRoad_A: mTLS response
XRoad_A->>API_A: Decrypted response
API_A->>OrgA_User: Data delivered6. MCP Tool Invocation Flow
mermaid
sequenceDiagram
actor AI_Agent
participant MCP as MCP Gateway
participant API as Real Estate API
participant EDC as EDC-V
participant Kafka as Kafka
AI_Agent->>MCP: Call tool (e.g., search_assets)
MCP->>MCP: Validate auth, rate limit
MCP->>API: Proxy to REST endpoint
API->>EDC: Query catalog (if needed)
EDC-->>API: Results
API-->>MCP: JSON response
MCP->>Kafka: Publish ToolInvoked event
MCP-->>AI_Agent: Tool resultEvent-Driven Architecture
Event Types
| Event | Source | Consumers | Purpose |
|---|---|---|---|
OrganizationCreated | API | EDC-V, KYC, Notifications | Trigger context provisioning |
KYCVerified | API | EDC-V, Keycloak, Notifications | Enable participant |
ParticipantContextCreated | EDC-V | API, Monitoring | Catalog registration ready |
AssetPublished | API | EDC-V, Elasticsearch, Notifications | Search indexing, catalog sync |
ContractNegotiationStarted | API | Monitoring, Notifications | Tracking, alerts |
ContractAgreed | API | Transfer, Billing, Notifications | Trigger transfer, invoice |
TransferCompleted | EDC-V | API, Billing, Audit, Notifications | Complete, bill, log |
ComplianceStatusChanged | KYC | API, Monitoring, Regulatory | Alerts, reporting |
Event Format (CloudEvents 1.0)
json
{
"specversion": "1.0",
"id": "550e8400-e29b-41d4-a716-446655440000",
"source": "real-estate-api",
"type": "com.realestate.asset.published.v1",
"time": "2024-01-15T10:30:00.000Z",
"datacontenttype": "application/json",
"subject": "asset/550e8400-e29b-41d4-a716-446655440001",
"data": {
"assetId": "550e8400-e29b-41d4-a716-446655440001",
"participantContextId": "550e8400-e29b-41d4-a716-446655440002",
"assetType": "real-estate-asset",
"name": "Paris Apartment",
"publishedAt": "2024-01-15T10:30:00.000Z"
}
}Kafka Topic Design
┌─────────────────────────────────────────────────────────────────┐
│ Kafka Cluster │
├─────────────────────────────────────────────────────────────────┤
│ participant.events (12 partitions, key=participant_id) │
│ ├── OrganizationCreated │
│ ├── OrganizationUpdated │
│ ├── ParticipantCreated │
│ ├── ParticipantUpdated │
│ ├── ParticipantContextCreated │
│ └── KYCVerified │
├─────────────────────────────────────────────────────────────────┤
│ asset.events (24 partitions, key=asset_id) │
│ ├── AssetCreated │
│ ├── AssetPublished │
│ ├── AssetUpdated │
│ ├── AssetDeprecated │
│ └── AssetDeleted │
├─────────────────────────────────────────────────────────────────┤
│ contract.events (12 partitions, key=negotiation_id) │
│ ├── NegotiationRequested │
│ ├── NegotiationOffered │
│ ├── NegotiationAccepted │
│ ├── NegotiationRejected │
│ ├── AgreementCreated │
│ └── AgreementTerminated │
├─────────────────────────────────────────────────────────────────┤
│ transfer.events (24 partitions, key=transfer_id) │
│ ├── TransferRequested │
│ ├── TransferProvisioned │
│ ├── TransferStarted │
│ ├── TransferCompleted │
│ ├── TransferFailed │
│ └── TransferTerminated │
├─────────────────────────────────────────────────────────────────┤
│ audit.events (6 partitions, key=correlation_id) │
│ ├── All events (duplicate for immutable audit log) │
├─────────────────────────────────────────────────────────────────┤
│ metrics.raw (48 partitions, key=metric_name) │
│ ├── RED metrics (rate, errors, duration) │
│ ├── USE metrics (utilization, saturation, errors) │
│ └── Business metrics │
└─────────────────────────────────────────────────────────────────┘Data Consistency Patterns
Saga Pattern (Distributed Transactions)
typescript
// Example: Participant onboarding saga
const onboardingSaga = defineSaga({
name: 'participant-onboarding',
steps: [
{
name: 'create-organization',
execute: async (ctx) => {
const org = await api.createOrganization(ctx.input);
ctx.compensate = async () => await api.deleteOrganization(org.id);
return { organizationId: org.id };
}
},
{
name: 'create-keycloak-client',
execute: async (ctx) => {
const client = await keycloak.createClient({ organizationId: ctx.organizationId });
ctx.compensate = async () => await keycloak.deleteClient(client.id);
return { keycloakClientId: client.id };
}
},
{
name: 'create-participant-context',
execute: async (ctx) => {
const context = await edc.createParticipantContext({
organizationId: ctx.organizationId,
keycloakClientId: ctx.keycloakClientId
});
ctx.compensate = async () => await edc.deleteParticipantContext(context.id);
return { participantContextId: context.id };
}
}
],
onFailure: async (ctx, failedStep) => {
// Execute compensations in reverse order
for (const step of ctx.completedSteps.reverse()) {
await step.compensate();
}
await notifyFailure(ctx.input.requestId, failedStep.error);
}
});Event Sourcing (Audit Log)
typescript
// All state changes stored as events
interface DomainEvent<T = unknown> {
eventId: UUID;
aggregateId: UUID;
aggregateType: string;
eventType: string;
payload: T;
metadata: {
correlationId: UUID;
causationId?: UUID;
userId?: UUID;
timestamp: ISODateString;
version: number;
};
}
// Reconstruct state from events
function reconstructAssetState(events: DomainEvent[]): Asset {
return events.reduce((state, event) => {
switch (event.eventType) {
case 'AssetCreated':
return { ...event.payload, version: 1 };
case 'AssetPublished':
return { ...state, status: 'published', version: state.version + 1 };
case 'AssetUpdated':
return { ...state, ...event.payload, version: state.version + 1 };
default:
return state;
}
}, {} as Asset);
}Next: Deployment for deployment guides, or Scaling for performance tuning.