Integration Patterns - pratchaya-maneechot/service-exchange GitHub Wiki

Integration Patterns

Pattern Types Used

1. Shared Kernel

Usage: Task Management ↔ Bidding & Negotiation

Both contexts share the same Task entity model as they need identical understanding of task structures.

// Shared Task aggregate
interface Task {
  id: TaskId;
  title: string;
  description: string;
  budget: MonetaryAmount;
  status: TaskStatus;
  location: Location;
  requirements: TaskRequirement[];
}

2. Customer-Supplier Relationships

Payment (Supplier) → Review (Customer)

  • Payment completion enables review process
  • Event: PaymentCompletedEnableReviewProcess

Task (Supplier) → Notification (Customer)

  • Task events trigger notifications
  • Event: TaskCreatedNotifyRelevantTaskers

3. Conformist Relationships

All Contexts → User & Identity Context

  • All services conform to User context's identity model
  • Shared user representation across system

4. Partnership Relationships

User Context ↔ Review Context

  • Bidirectional dependency
  • User reputation affects profile, reviews affect user standing

5. Open Host Service

Payment Context → External Payment Gateways

  • Standardized interface for multiple payment providers
  • Anti-corruption layer for external systems

Communication Matrix

Pattern From Service To Service Communication Type
Event-Driven Task Notification Async (Kafka)
Event-Driven Payment Review Async (Kafka)
Event-Driven Bidding Payment Async (Kafka)
Synchronous All Services User & Identity Sync (REST)
Synchronous Task Location Sync (REST)
⚠️ **GitHub.com Fallback** ⚠️