Engineering Playbook
Enterprise Architecture

Integration Patterns

EIP, Messaging, and connecting systems.

Enterprise Integration Patterns (EIP)

Systems rarely live in isolation. Integration is the "glue" that holds the enterprise together.

The Authority on Integration

This topic is massive. The patterns below are the ones I encounter most frequently in modern distributed systems.

For the complete catalog of 65+ patterns, refer to the industry standard: Enterprise Integration Patterns (Gregor Hohpe & Bobby Woolf).


The 4 Integration Styles

How do applications exchange data?

  1. File Transfer: System A writes a CSV, System B reads it.
    • Use Case: Batch processing, legacy mainframes.
    • Drawback: Not real-time, data consistency lag.
  2. Shared Database: System A and B read the same SQL tables.
    • Use Case: Simple monolithic systems.
    • Drawback: Strong coupling. If you change the schema, you break both apps. Avoid in distributed systems.
  3. Remote Procedure Invocation (RPC/REST): System A calls System B's API.
    • Use Case: Real-time user interactions.
    • Drawback: Tight coupling to availability (if B is down, A fails).
  4. Messaging: System A sends a message to a broker; B consumes it.
    • Use Case: Decoupled, asynchronous workflows.
    • Drawback: Added infrastructure complexity, eventual consistency.

Topologies

Point-to-Point

Every system connects directly to every other system.

  • Result: N(N-1)/2 connections.
  • Verdict: "Spaghetti Architecture." High maintenance nightmare.

Real-World Problems:

  • Adding new system requires changes to all existing systems
  • No centralized monitoring or governance
  • Tight coupling makes independent deployment impossible
  • Testing becomes exponentially complex

Hub-and-Spoke (Broker)

A central message broker (RabbitMQ, Kafka, SQS) manages traffic.

  • Result: Decoupled systems. The sender doesn't need to know who the receiver is or if they are online.
  • Verdict: The standard for modern microservices.

Benefits:

  • Easy to add new consumers/producers
  • Centralized monitoring and management
  • Natural load balancing and scaling
  • Built-in retry and persistence

Bus (ESB)

An intelligent pipe that handles routing and transformation.

  • Verdict: Proceed with caution. In the mid-2000s, ESBs became bloated with business logic. The modern preference is "Smart Endpoints, Dumb Pipes."

Modern Alternatives:

  • API Gateways for routing and transformation
  • Sidecar patterns for cross-cutting concerns
  • Service meshes for service-to-service communication

Real-World Integration Scenarios

Scenario 1: E-Commerce Order Processing

Integration Challenges Solved:

  • Order processing continues even if payment service is temporarily down
  • New services (like fraud detection) can be added without changing order service
  • Each service can scale independently based on load
  • Natural audit trail through event log

Scenario 2: Legacy System Integration

Key Components:

  • Anti-Corruption Layers translate between modern APIs and legacy protocols
  • API Gateway provides unified entry point
  • Data Transformation handles format differences (JSON ↔ XML)
  • Protocol Bridging converts REST to SOAP/file-based interfaces

Benefits:

  • Legacy systems can be modernized incrementally
  • Modern services protected from legacy complexity
  • Clear boundaries prevent tight coupling
  • Easier testing and maintenance

Scenario 3: Multi-Cloud Data Integration

Integration Patterns Used:

  • Change Data Capture (CDC) for real-time data replication
  • Message Broker for cross-cloud data streaming
  • Data Transformation in flight for different cloud requirements
  • Multi-tenant Processing for different data consumers

Essential Async Patterns

1. Dead Letter Queue (DLQ)

What happens when a message can't be processed (malformed JSON, logic bug)?

  • Don't: Block the queue and stop processing valid messages (Head-of-Line blocking).
  • Do: Move the failed message to a side "Dead Letter" queue for human inspection or automated retry later.

2. Idempotent Receiver

In distributed messaging, you will receive duplicate messages (network retries, at-least-once delivery).

  • The Rule: Processing the same message twice must not corrupt the state.
  • The Fix: Track processed Message IDs in a Redis cache or a dedicated DB table. If seen before, acknowledge and ignore.

3. Scatter-Gather

You need to ask multiple vendors for a quote (e.g., "Get Flight Price").

  1. Scatter: Broadcast the request to all vendors.
  2. Gather: Wait for replies.
  3. Aggregate: Return the best price once a timeout is reached or all replies are in.

Integration Best Practices

1. Start with the Business Process

  • Map the actual business workflow first
  • Identify system boundaries and data flows
  • Consider error scenarios and recovery paths
  • Design for business continuity

2. Choose the Right Integration Style

Use CaseRecommended StyleExamples
Real-time user interactionREST/RPCMobile apps, web UI
Batch data processingFile TransferETL jobs, reporting
Loose coupling neededMessagingMicroservices, event-driven
Legacy integrationAnti-CorruptionERP integration, migrations

3. Handle Failure Gracefully

  • Implement circuit breakers for external dependencies
  • Use dead letter queues for failed messages
  • Design for idempotency to handle retries
  • Monitor and alert on integration failures

4. Security Considerations

  • Encrypt data in transit and at rest
  • Implement proper authentication/authorization
  • Use API keys and secrets management
  • Log and audit all cross-system communications

5. Monitoring and Observability

  • Trace requests across system boundaries
  • Monitor message queue depths and processing times
  • Set up alerts for integration failures
  • Measure business metrics, not just technical ones

Explore Full Catalog

View the visual catalog of all messaging patterns.

Integration Tools

Popular tools: Apache Kafka, RabbitMQ, MuleSoft, Boomi, Apache Camel.