{
  "title": "Aggregator Pattern",
  "description": "Aggregates multiple related messages into a single composite message",
  "type": "integration-pattern",
  "data": {
    "nodes": [
      {
        "id": "event-order-item-1",
        "type": "event",
        "position": { "x": 50, "y": 100 },
        "data": {
          "mode": "full",
          "message": {
            "id": "order-item-1",
            "name": "Order Item A",
            "version": "1.0.0",
            "summary": "Individual order item with product details and quantity"
          }
        },
        "measured": {"width": 180, "height": 80}
      },
      {
        "id": "event-order-item-2",
        "type": "event",
        "position": { "x": 50, "y": 200 },
        "data": {
          "mode": "full",
          "message": {
            "id": "order-item-2",
            "name": "Order Item B",
            "version": "1.0.0",
            "summary": "Individual order item with product details and quantity"
          }
        },
        "measured": {"width": 180, "height": 80}
      },
      {
        "id": "event-order-item-3",
        "type": "event",
        "position": { "x": 50, "y": 300 },
        "data": {
          "mode": "full",
          "message": {
            "id": "order-item-3",
            "name": "Order Item C",
            "version": "1.0.0",
            "summary": "Individual order item with product details and quantity"
          }
        },
        "measured": {"width": 180, "height": 80}
      },
      {
        "id": "service-aggregator",
        "type": "service",
        "position": { "x": 400, "y": 200 },
        "data": {
          "mode": "full",
          "service": {
            "id": "order-aggregator",
            "name": "Order Aggregator",
            "owners": ["integration-team"],
            "sends": ["CompleteOrder"],
            "receives": ["OrderItem"],
            "version": "1.0.0",
            "summary": "Collects and combines related order items into complete order"
          }
        },
        "measured": {"width": 262, "height": 113}
      },
      {
        "id": "event-complete-order",
        "type": "event",
        "position": { "x": 750, "y": 200 },
        "data": {
          "mode": "full",
          "message": {
            "id": "complete-order",
            "name": "Complete Order",
            "version": "1.0.0",
            "summary": "Aggregated message containing all order items and totals"
          }
        },
        "measured": {"width": 180, "height": 80}
      },
      {
        "id": "data-correlation-store",
        "type": "data",
        "position": { "x": 400, "y": 50 },
        "data": {
          "mode": "full",
          "data": {
            "id": "correlation-store",
            "name": "Correlation Store",
            "owners": ["integration-team"],
            "version": "1.0.0",
            "summary": "Temporary storage for collecting related messages by correlation ID",
            "type": "Cache"
          }
        },
        "measured": {"width": 262, "height": 98}
      },
      {
        "id": "service-downstream-processor",
        "type": "service",
        "position": { "x": 1000, "y": 200 },
        "data": {
          "mode": "full",
          "service": {
            "id": "order-processor",
            "name": "Order Processor",
            "owners": ["fulfillment-team"],
            "sends": ["OrderProcessed"],
            "receives": ["CompleteOrder"],
            "version": "1.0.0",
            "summary": "Processes complete orders for fulfillment"
          }
        },
        "measured": {"width": 262, "height": 98}
      },
      {
        "id": "note-aggregator-instructions",
        "type": "note",
        "position": { "x": 50, "y": 400 },
        "data": {
          "text": "🔄 **Aggregator Pattern (EIP)**\\n\\nCombines multiple related messages into a single composite message:\\n\\n**📨 Individual Messages** → **🔄 Aggregator Service** → **📦 Aggregated Message**\\n\\n**Key Components:**\\n• **Correlation ID** - Links related messages together\\n• **Aggregation Rules** - Defines when aggregation is complete\\n• **Timeout Handling** - Releases partial aggregations after time limit\\n• **Correlation Store** - Temporary storage for incomplete aggregations\\n\\n**How it works:**\\n1. **Individual messages** arrive with correlation identifiers\\n2. **Aggregator** groups messages by correlation ID\\n3. **Completion condition** triggers when all expected messages received\\n4. **Composite message** published with aggregated data\\n5. **Timeout mechanism** handles incomplete message sets\\n\\n**Use Cases:**\\n• Order line items → Complete order\\n• Sensor readings → Summary report\\n• Partial responses → Complete response\\n• Fragmented data → Consolidated record\\n\\n**💡 Pro tip:** Set reasonable timeouts and handle partial aggregations gracefully!",
          "color": "purple"
        },
        "measured": {"width": 400, "height": 320},
        "width": 400,
        "height": 320
      }
    ],
    "edges": [
      {
        "source": "event-order-item-1",
        "target": "service-aggregator",
        "label": "Consumed by",
        "markerEnd": {"type": "arrowclosed", "color": "#000000"},
        "animated": true,
        "type": "animatedMessage",
        "id": "xy-edge__event-order-item-1-service-aggregator"
      },
      {
        "source": "event-order-item-2",
        "target": "service-aggregator",
        "label": "Consumed by",
        "markerEnd": {"type": "arrowclosed", "color": "#000000"},
        "animated": true,
        "type": "animatedMessage",
        "id": "xy-edge__event-order-item-2-service-aggregator"
      },
      {
        "source": "event-order-item-3",
        "target": "service-aggregator",
        "label": "Consumed by",
        "markerEnd": {"type": "arrowclosed", "color": "#000000"},
        "animated": true,
        "type": "animatedMessage",
        "id": "xy-edge__event-order-item-3-service-aggregator"
      },
      {
        "source": "service-aggregator",
        "target": "data-correlation-store",
        "label": "Stores in",
        "markerEnd": {"type": "arrowclosed", "color": "#000000"},
        "animated": false,
        "type": "default",
        "id": "xy-edge__service-aggregator-data-correlation-store"
      },
      {
        "source": "service-aggregator",
        "target": "event-complete-order",
        "label": "Publishes",
        "markerEnd": {"type": "arrowclosed", "color": "#000000"},
        "animated": true,
        "type": "animatedMessage",
        "id": "xy-edge__service-aggregator-event-complete-order"
      },
      {
        "source": "event-complete-order",
        "target": "service-downstream-processor",
        "label": "Consumed by",
        "markerEnd": {"type": "arrowclosed", "color": "#000000"},
        "animated": true,
        "type": "animatedMessage",
        "id": "xy-edge__event-complete-order-service-downstream-processor"
      }
    ],
    "viewport": {"x": 50, "y": 50, "zoom": 0.7},
    "creationDate": "2025-01-01T00:00:00.000Z",
    "name": "Aggregator Pattern",
    "version": "1.0.0",
    "source": "https://eventcatalog.dev",
    "appState": {},
    "id": "aggregator-pattern"
  },
  "usecase": "Message Aggregation",
  "mermaid": "flowchart LR\n    A1[Item A] --> AGG[Aggregator]\n    A2[Item B] --> AGG\n    A3[Item C] --> AGG\n    AGG --> CO[Complete Order]\n    CO --> P[Processor]",
  "tags": ["Integration"]
}