Integration reference

From Crapule421/tiger-team · View interactive version

Integration reference is an AI agent skill from the GitHub repository Crapule421/tiger-team. Integration knowledge base - pattern selection, idempotence, replay, dead letters, correlation, versioning, interface security and review checklist; references on REST/SOAP/ESB, MFT/MQ/Kafka and business formats (ISO 20022, EDI, HL7, FHIR).

How to use this skill

Skill file

Integration Reference (Integration Expert)

Product facts that vary by version are marked "verify against your version"; standards facts marked "verify" must be checked against the current specification before being written into a contract.

References index

Related: interface contract template ${CLAUDE_PLUGIN_ROOT}/skills/deliverables/templates/interface-contract.md; ERP side of interfaces ${CLAUDE_PLUGIN_ROOT}/skills/erp-reference/SKILL.md.

1. Pattern selection

| Pattern | Use when | Avoid when | Design points |

|---|---|---|---|

| Synchronous request-reply (REST, SOAP, gRPC) | Caller cannot continue without the answer (lookup, validation, pricing, authorisation); small payloads | Provider less available than caller; processing > a few seconds; bulk | Timeout at every hop (caller timeout > callee timeout + margin), retry only idempotent calls, circuit breaker, defined degraded mode |

| Asynchronous request-reply (queue + reply-to + correlation ID) | Variable or long processing, provider offline windows, need for buffering | A user waits on screen with no timeout UX | Reply destination, correlation ID, reply timeout, handling of late replies |

| Fire-and-forget command | One owner must act; sender does not need the result immediately | Sender must know the business outcome | Business acknowledgment flow if outcome matters |

| Event notification / pub-sub | Fan-out to N consumers; consumers added without changing the producer | Command with a single owner disguised as an event | Event ownership, schema governance, per-key ordering, retention for replay |

| Event-carried state transfer | Consumers need a local copy (read models, caches) | Per-consumer confidentiality on fields | Full state vs delta, compaction, snapshot for late joiners |

| Thin event + callback (claim check) | Large or sensitive payloads; consumer-specific authorisation | Very high volume (callback storms) | Callback API capacity; state may have changed between event and callback |

| File transfer (MFT) | Bulk, batch windows, banks/authorities/partners, legacy | Per-record latency in seconds | Naming, atomic delivery, control totals, ack/reject files, archive-based replay |

| CDC, log-based (DB transaction log) | Propagate DB changes without changing the application; feed events/DWH | Business meaning only exists in application logic; unstable schema | Initial snapshot + streaming, per-key ordering, DDL changes, delete propagation, outbox instead of raw tables when possible |

| CDC, query/trigger-based | Log access impossible | High volume, hard deletes, clock skew | Watermark (timestamp, id) with overlap, soft deletes or tombstones, trigger cost on OLTP |

| Batch ETL/ELT | Large volumes, reconciliation-driven, analytics | Operational real-time needs | Restartability, checkpoints, partial-failure policy, run-once guarantee |

| Shared database | Never as an integration contract between owned applications | — | Tolerated only as read-only view/replica with an explicit contract and owner |

Batch vs real-time

| Criterion | Favours real-time (API/event) | Favours batch (file/ETL) |

|---|---|---|

| Business latency | Seconds to minutes | Hours, end-of-day |

| Partner capability | API, broker | File only (banks, authorities, legacy, IBM i/mainframe) |

| Unit of reconciliation | Per message | Per file with control totals |

| Consistency | Per business key | Snapshot consistent at a cut-off time |

| Peak profile | Smooth | Concentrated (month-end, payroll) |

| Failure blast radius | One record | Whole file (unless per-record rejects are designed) |

| Cost of operation | Broker/gateway run, 24/7 support | Scheduling chain, batch windows |

Coupling to check for each flow: temporal (both must be up), format (shared schema), location (hard-coded endpoints), semantic (shared code lists/meaning). Async messaging removes temporal coupling only.

2. Delivery semantics and idempotence

| Semantics | Reality | Requirement |

|---|---|---|

| At-most-once | Loss possible, no duplicates | Only for telemetry/non-critical notifications |

| At-least-once | No loss if acked correctly, duplicates possible | Default of MQ, RabbitMQ, Kafka, MFT retries, HTTP retries: consumers MUST be idempotent |

| Exactly-once | Only inside a closed transactional scope (XA two-phase commit; Kafka transactions for read-process-write within Kafka) | End to end it is "effectively once" = at-least-once + idempotent processing |

Idempotence techniques

| Technique | How | Notes |

|---|---|---|

| Natural business key | Unique constraint on (source, business ID), e.g. invoice number + supplier | Best when the business key is truly unique and stable |

| Idempotency key | Producer generates a unique key per business operation (UUID); consumer stores key + result | Keep keys ≥ max replay/retry window; return the stored result on duplicate. HTTP header Idempotency-Key is still an IETF HTTPAPI working-group draft (draft-ietf-httpapi-idempotency-key-header), not an RFC as of October 2026 |

| Upsert / set-state semantics | "Set status = SHIPPED" instead of "increment" | Combine with version numbers to reject stale updates |

| Version / sequence per key | Reject or park messages older than the stored version | Handles out-of-order delivery |

| File registry | Store file ID + SHA-256 of received files; reject or flag duplicates | Same name with different content is a different case: alert |

| Outbox (producer) | Write business change + outgoing message in the same DB transaction; relay publishes | Avoids dual-write loss; relay is at-least-once |

| Inbox (consumer) | Store processed message IDs in the same transaction as the business change | Atomic dedup |

Rules: never use the trace ID as an idempotency key; POST without an idempotency key must not be retried automatically for money-moving or stock-moving operations; dedup store retention > retry horizon + replay horizon.

Ordering: guaranteed only per partition/queue with a single active consumer; design for per-business-key ordering (Kafka key, MQ message groups, single-threaded consumer per key). Cross-entity ordering (customer before order) is handled by parking + retry or by including the dependency in the payload, not by hoping.

3. Replay and reprocessing

Prerequisites before any replay:

Replay mechanisms: reset consumer offset / dedicated replay consumer group (Kafka); move messages from DLQ/backout queue back to input (MQ, RabbitMQ) with tooling, not manual copy-paste; resend file from MFT catalog/archive under a new transfer ID but same business file ID; re-extract by business key range for APIs. Document a "replay runbook" per interface.

4. Error handling and dead letters

| Error class | Examples | Handling |

|---|---|---|

| Transient technical | Timeout, connection reset, HTTP 429/502/503/504, DB lock timeout, broker failover | Retry with exponential backoff + jitter, bounded; honour Retry-After; then park/DLQ + alert |

| Permanent technical | Malformed payload, schema violation, unknown version, deserialisation error, HTTP 400 | No retry; DLQ immediately with diagnostics; alert owner |

| Functional (business) | Unknown customer, closed period, duplicate invoice, amount above limit | Reject to sender with business code (RFC 9457 problem, pain.002, HL7 ACK AE/AR, EDIFACT APERAK) or route to a business work queue; no technical retry |

| Dependency not ready | Order arrives before customer master data | Delayed retry/parking with a bounded wait, then functional error |

| Poison message | Crashes the consumer at every attempt | Backout count threshold → backout/DLQ; never block the whole queue |

Retry baseline (adapt per SLA): 3-5 attempts, base 1-2 s, factor 2, cap 1-5 min, full jitter. Retry at ONE layer only (3 layers × 3 retries = 27 calls). Total retry time < message expiry and < caller timeout.

Dead letter design: keep original payload untouched + headers + error code/text + timestamp + attempt count + source destination + consumer version. Each DLQ has an owner, an alert on "depth > 0" or age, a replay tool, a retention rule, and the same data protection as the main flow (DLQs often hold personal data). Never purge a DLQ without reconciliation. Functional rejects should not land in the technical DLQ: business users need their own work queue.

Acknowledgments: distinguish transport ack (file received, message accepted), technical ack (syntax/schema valid) and business ack (accepted/posted, with references). Contracts must state which ones exist, their format and timeout, and what the sender does when no ack arrives.

5. Correlation and traceability

| Identifier | Scope | Set by | Carried in |

|---|---|---|---|

| Message ID | One technical message | Producer | IBM MQ MQMD MsgId, JMSMessageID, AMQP message-id, Kafka header, HTTP header |

| Correlation ID | Links reply to request / steps of one exchange | Requester | MQMD CorrelId, JMSCorrelationID, AMQP correlation-id, HTTP header |

| Trace context | Distributed technical trace | First instrumented component | W3C Trace Context traceparent/tracestate (HTTP), copied into message headers |

| Business key | Business object | Business system | Payload (order number, EndToEndId, invoice number, visit number) |

| File / batch ID | File or batch | Sender | File name, header record, ISO 20022 GrpHdr/MsgId, EDIFACT UNB control reference |

Rules: log all relevant IDs at every hop (ingress, transformation, egress); propagate, never regenerate mid-flow; one business key must allow end-to-end search across middleware, ERP and partner reports.

6. Observability

Per interface, monitor:

Logs: structured (JSON), correlation IDs, no secrets, no full payloads or personal data in standard logs; payload archive separate, access-controlled, with retention aligned to legal and GDPR rules. Traces: OpenTelemetry across gateways, ESB and consumers where supported. Every alert has an owner, a severity and a runbook entry. Regulated contexts: banking incident classification data (DORA) and healthcare access traceability must be obtainable from these signals.

7. Versioning and compatibility

| Change | Compatibility |

|---|---|

| Add optional field / new operation / new event type | Compatible if consumers are tolerant readers |

| Add enum value | Breaks strict consumers — contract must state "consumers must accept unknown values" |

| Tighten validation, change default, change ordering, change field meaning with same schema | Breaking (semantic) |

| Remove/rename field, change type/format, shorten length, optional → mandatory, change ID semantics or error codes | Breaking |

Rules: semantic versioning of the contract (MAJOR.MINOR.PATCH); major version visible (URL /v2, media type, topic name, file layout version in header record); run N and N-1 in parallel with a published deprecation date (HTTP Deprecation header, RFC 9745 Proposed Standard 2025, and Sunset header, RFC 8594 Informational); consumer inventory (gateway analytics, broker ACLs, MFT partner list) before removal; tolerant reader + strict writer; consumer-driven contract tests in CI; for events use a schema registry with an enforced compatibility mode (see mft-mq-kafka.md); never change a fixed-width layout without a new version identifier.

8. Interface security

| Mechanism | Use | Must-haves | Pitfalls |

|---|---|---|---|

| OAuth 2.0 client credentials (RFC 6749 §4.4) | Machine-to-machine API calls | Short-lived access tokens, one client per consuming application, minimal scopes, audience restriction, token cached until near expiry; client authentication by private_key_jwt (RFC 7523) or mTLS (RFC 8705) rather than shared secrets where possible; follow OAuth security BCP (RFC 9700) | One client for many apps; secrets in config repos; a token request per API call; no revocation/rotation process |

| mTLS | Mutual authentication between systems/partners, zero-trust internal flows | Trusted CA chain validation, subject/SAN allowlist, expiry monitoring, rotation with overlap (old + new accepted), CRL/OCSP policy | TLS terminated at a load balancer without securely forwarding the verified client identity; pinning that blocks rotation |

| JWT (RFC 7519) | Access tokens, client assertions, signed claims | Validate signature with algorithm allowlist (never none), iss, aud, exp, nbf, kid resolved via JWKS with caching; JWT BCP RFC 8725 | Sensitive data in a signed (not encrypted) token; long lifetimes; accepting tokens issued for another audience |

| API keys | Consumer identification, quotas, low-risk APIs | Header (never URL), one key per consumer and environment, rotation, combined with OAuth2/mTLS for sensitive data | Treated as strong authentication; leaked in logs and URLs |

| Message / file signing | Integrity and non-repudiation independent of transport | JWS (RFC 7515), XML-DSig, HTTP Message Signatures (RFC 9421), CMS/PGP for files; signed timestamps where non-repudiation matters | Intermediaries reformatting signed XML (canonicalisation breaks); keys without lifecycle |

| Payload encryption | Confidentiality across intermediaries/storage | JWE, XML-Enc, CMS/PGP; key rotation; integrity protection too | Encryption without integrity; inability to scan content |

| Webhook verification | Inbound callbacks from SaaS/partners | HMAC or signature over raw body + timestamp, reject stale timestamps, idempotent by event ID | Verifying signature on a re-serialised body |

Baseline: TLS 1.2 minimum, TLS 1.3 preferred, cipher suites per the ANSSI guide "Recommandations de sécurité relatives à TLS" (ANSSI-PA-035, version 1.2 of March 2020 at the time of writing); secrets in a vault, rotated, never in repositories or scripts; dedicated least-privilege technical account per interface and environment; schema validation, size limits, XXE disabled, archive bomb limits; network filtering and DMZ relay for external partners; GDPR minimisation (only fields the purpose requires) and retention of payload archives; health data hosted per HDS rules; financial entities: DORA third-party and incident rules; classified/Diffusion Restreinte flows out of scope of cloud tooling (hand off to devsecops-expert / infra-expert).

9. Interface review checklist

Business and ownership

Contract

Flow

Reliability

Security

Operations

Change

10. Pitfalls seen in production

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.