{
  "code": null,
  "collection": "architecture",
  "href": "https://banes-lab.com/ontology#architecture-idempotent-consumer",
  "id": "idempotent-consumer",
  "kind": "pattern",
  "layer": {
    "href": "https://banes-lab.com/ontology/schema#layer-execution-core",
    "json": "https://banes-lab.com/json/records/layer/execution-core",
    "label": "Execution Core",
    "markdown": "https://banes-lab.com/records/layer/execution-core.md",
    "ref": "layer:execution-core"
  },
  "name": "Idempotent Consumer",
  "ref": "architecture:idempotent-consumer",
  "relations": [
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-deduplication-key",
          "json": "https://banes-lab.com/json/records/lexicon/deduplication-key",
          "label": "Deduplication Key",
          "markdown": "https://banes-lab.com/records/lexicon/deduplication-key.md",
          "ref": "lexicon:deduplication-key"
        }
      ],
      "relation": "requires"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology#architecture-eventual-consistency",
          "json": "https://banes-lab.com/json/records/architecture/eventual-consistency",
          "label": "Eventual Consistency",
          "markdown": "https://banes-lab.com/records/architecture/eventual-consistency.md",
          "ref": "architecture:eventual-consistency"
        },
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-at-least-once-delivery-safety",
          "json": "https://banes-lab.com/json/records/lexicon/at-least-once-delivery-safety",
          "label": "At-Least-Once Delivery Safety",
          "markdown": "https://banes-lab.com/records/lexicon/at-least-once-delivery-safety.md",
          "ref": "lexicon:at-least-once-delivery-safety"
        }
      ],
      "relation": "reinforces"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-safe-message-redelivery",
          "json": "https://banes-lab.com/json/records/lexicon/safe-message-redelivery",
          "label": "Safe Message Redelivery",
          "markdown": "https://banes-lab.com/records/lexicon/safe-message-redelivery.md",
          "ref": "lexicon:safe-message-redelivery"
        }
      ],
      "relation": "enables"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-duplicate-side-effects",
          "json": "https://banes-lab.com/json/records/lexicon/duplicate-side-effects",
          "label": "Duplicate Side Effects",
          "markdown": "https://banes-lab.com/records/lexicon/duplicate-side-effects.md",
          "ref": "lexicon:duplicate-side-effects"
        }
      ],
      "relation": "conflicts-with"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-state-overhead",
          "json": "https://banes-lab.com/json/records/lexicon/state-overhead",
          "label": "State Overhead",
          "markdown": "https://banes-lab.com/records/lexicon/state-overhead.md",
          "ref": "lexicon:state-overhead"
        }
      ],
      "relation": "tensions-with"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology/schema#tension-idempotent-consumer-state-overhead",
          "json": "https://banes-lab.com/json/records/tension/idempotent-consumer-state-overhead",
          "label": "Idempotent Consumer / State Overhead",
          "markdown": "https://banes-lab.com/records/tension/idempotent-consumer-state-overhead.md",
          "ref": "tension:idempotent-consumer-state-overhead"
        }
      ],
      "relation": "tensions"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-duplicate-side-effects",
          "json": "https://banes-lab.com/json/records/lexicon/duplicate-side-effects",
          "label": "Duplicate Side Effects",
          "markdown": "https://banes-lab.com/records/lexicon/duplicate-side-effects.md",
          "ref": "lexicon:duplicate-side-effects"
        }
      ],
      "relation": "violated-by"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology/schema#vocabulary-severity-contextual",
          "json": "https://banes-lab.com/json/records/vocabulary/severity-contextual",
          "label": "contextual",
          "markdown": "https://banes-lab.com/records/vocabulary/severity-contextual.md",
          "ref": "vocabulary:severity-contextual"
        }
      ],
      "relation": "severity"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology#architecture-category-event-messaging-asynchronous-architecture",
          "json": "https://banes-lab.com/json/records/architecture-category/event-messaging-asynchronous-architecture",
          "label": "Event / Messaging / Asynchronous Architecture",
          "markdown": "https://banes-lab.com/records/architecture-category/event-messaging-asynchronous-architecture.md",
          "ref": "architecture-category:event-messaging-asynchronous-architecture"
        }
      ],
      "relation": "category"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/ontology#architecture-dual-write",
          "json": "https://banes-lab.com/json/records/architecture/dual-write",
          "label": "Dual Write",
          "markdown": "https://banes-lab.com/records/architecture/dual-write.md",
          "ref": "architecture:dual-write"
        },
        {
          "href": "https://banes-lab.com/ontology#architecture-idempotency",
          "json": "https://banes-lab.com/json/records/architecture/idempotency",
          "label": "Idempotency",
          "markdown": "https://banes-lab.com/records/architecture/idempotency.md",
          "ref": "architecture:idempotency"
        }
      ],
      "relation": "refactors"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/disciplined-methodology/collaborate#posting-and-waiting-are-one-operation",
          "json": "https://banes-lab.com/json/disciplined-methodology/collaborate/posting-and-waiting-are-one-operation",
          "label": "Posting and waiting are one operation",
          "markdown": "https://banes-lab.com/disciplined-methodology/collaborate/posting-and-waiting-are-one-operation.md",
          "ref": "chapter:/disciplined-methodology/collaborate#posting-and-waiting-are-one-operation"
        },
        {
          "href": "https://banes-lab.com/ontology#architecture-category-anti-patterns",
          "json": "https://banes-lab.com/json/ontology/principles/architecture-category-anti-patterns",
          "label": "Anti-patterns",
          "markdown": "https://banes-lab.com/ontology/principles/architecture-category-anti-patterns.md",
          "ref": "chapter:/ontology#architecture-category-anti-patterns"
        },
        {
          "href": "https://banes-lab.com/ontology#architecture-category-event-messaging-asynchronous-architecture",
          "json": "https://banes-lab.com/json/ontology/principles/architecture-category-event-messaging-asynchronous-architecture",
          "label": "Event / Messaging / Asynchronous Architecture",
          "markdown": "https://banes-lab.com/ontology/principles/architecture-category-event-messaging-asynchronous-architecture.md",
          "ref": "chapter:/ontology#architecture-category-event-messaging-asynchronous-architecture"
        },
        {
          "href": "https://banes-lab.com/ontology#architecture-category-transactions-state-concurrency",
          "json": "https://banes-lab.com/json/ontology/principles/architecture-category-transactions-state-concurrency",
          "label": "Transactions / State / Concurrency",
          "markdown": "https://banes-lab.com/ontology/principles/architecture-category-transactions-state-concurrency.md",
          "ref": "chapter:/ontology#architecture-category-transactions-state-concurrency"
        },
        {
          "href": "https://banes-lab.com/ontology/lexicon#lexicon-category-event-messaging-async",
          "json": "https://banes-lab.com/json/ontology/lexicon/lexicon-category-event-messaging-async",
          "label": "Event Messaging Async",
          "markdown": "https://banes-lab.com/ontology/lexicon/lexicon-category-event-messaging-async.md",
          "ref": "chapter:/ontology/lexicon#lexicon-category-event-messaging-async"
        },
        {
          "href": "https://banes-lab.com/ontology/schema#the-vocabulary-severity",
          "json": "https://banes-lab.com/json/ontology/schema/the-vocabulary-severity",
          "label": "Severity levels",
          "markdown": "https://banes-lab.com/ontology/schema/the-vocabulary-severity.md",
          "ref": "chapter:/ontology/schema#the-vocabulary-severity"
        },
        {
          "href": "https://banes-lab.com/ontology/schema#the-resolutions",
          "json": "https://banes-lab.com/json/ontology/schema/the-resolutions",
          "label": "The resolutions",
          "markdown": "https://banes-lab.com/ontology/schema/the-resolutions.md",
          "ref": "chapter:/ontology/schema#the-resolutions"
        }
      ],
      "relation": "linked-from"
    }
  ],
  "summary": "A design pattern in which a consumer records each message it has processed, so a redelivered message has no second effect.",
  "siblings": {
    "next": {
      "href": "https://banes-lab.com/ontology#architecture-competing-consumers",
      "json": "https://banes-lab.com/json/records/architecture/competing-consumers",
      "label": "Competing Consumers",
      "markdown": "https://banes-lab.com/records/architecture/competing-consumers.md",
      "ref": "architecture:competing-consumers"
    },
    "previous": {
      "href": "https://banes-lab.com/ontology#architecture-dead-letter-queue",
      "json": "https://banes-lab.com/json/records/architecture/dead-letter-queue",
      "label": "Dead-Letter Queue",
      "markdown": "https://banes-lab.com/records/architecture/dead-letter-queue.md",
      "ref": "architecture:dead-letter-queue"
    }
  },
  "up": {
    "href": null,
    "json": "https://banes-lab.com/json/api/records/architecture",
    "label": "Architecture principles",
    "markdown": "https://banes-lab.com/api/records/architecture.md",
    "ref": "api:records/architecture"
  },
  "aliases": [],
  "exemplar": {
    "after": "worker.consume(fooQueue, async message => {\n  if (await processedMessages.has(message.id)) return;\n  await chargeFoo(message.fooId, message.amount);\n  await processedMessages.add(message.id);\n});",
    "before": "worker.consume(fooQueue, message => chargeFoo(message.fooId, message.amount));",
    "lang": "ts",
    "medium": "code"
  },
  "formedBy": null,
  "scope": [
    "service",
    "messaging",
    "correctness"
  ],
  "severity": "contextual"
}
