Stackbook Logo
messagingestablished · medium operational burden

Claim Check

Also known as: reference-based messaging, large payload offloading

Intent

Keep messages small by storing large payloads in external storage and sending only a reference through the broker.

Problem

Brokers limit message size and degrade when carrying megabytes. Large messages inflate memory, replication and network cost for every subscriber, even those that ignore the body.

Forces

  • •Broker message size limits
  • •Throughput drops with payload size
  • •Only some consumers need the full payload
  • •Stored payloads need lifecycle and access control

Solution

Overview

Like a coat check ticket, the message carries a claim token while the heavy item sits in storage.

The order of operations matters: upload first, publish second, so a message never points at a missing object.

A related choice is how consumers authenticate to storage. Pre-signed URLs with short expiry let the message carry a self-contained link, but they can expire before a delayed consumer reads them. References plus consumer IAM roles avoid this, at the cost of managing permissions for every reader.

How it works

The producer uploads the blob, then publishes the reference. Consumers dereference lazily, verifying the checksum.

key = s3.put("payloads/" + uuid, body)
broker.publish("reports", {
  "claim": key, "bytes": len(body),
  "sha256": digest, "type": "report.ready"
})

Some client libraries implement the pattern transparently, offloading bodies above a threshold, for example a quarter of a megabyte. That is convenient, but you still own cleanup and must understand what happens on partial failure. Encrypt stored payloads, since object storage often outlives the broker and holds sensitive data, and tag objects with the message id for traceability.

Pitfalls

  • Publishing before the upload completes, so consumers hit missing objects.
  • Short TTL on payloads while the queue backlog is longer.
  • Mutable objects, which make replays return different data than the original.
  • Giving consumers broad storage permissions instead of scoped, expiring access.

Key takeaways

  • Upload first, publish the reference second.
  • Make payloads immutable and checksummed.
  • Align payload TTL with worst-case message retention.
  • Scope access to the reference holder.

✓ When to Use

  • •Payloads such as images, documents or batches exceed broker limits
  • •Many subscribers need only metadata
  • •Payload retention differs from message retention

✗ When Not to Use

  • •Messages are already small
  • •Strict atomic delivery of data and notification is needed without a second system
  • •Storage latency would break a tight latency budget

Pros

  • +Small fast messages
  • +Broker cost and memory stay low
  • +Payload access can be controlled separately

Cons

  • −Two systems to keep consistent
  • −Extra read latency for consumers
  • −Orphaned payloads if cleanup fails

Cost Profile

Infrastructure

Medium - object store plus broker

Operational

Medium - lifecycle and cleanup

Cognitive

Low - simple concept

Failure Modes

  • Message published but payload upload failed or vice versa

  • Payload deleted before a slow consumer reads it

  • Orphaned blobs accumulate cost

Real-World Examples

Alternatives

    Related Patterns

    • publish-subscribe
    • outbox-pattern

    Competency Domains

    distribution communicationeconomics evolution