---
title: "Full examples"
description: "Three complete programs, simple to complex, in JavaScript, Python and Go: the whole file, not a fragment, and every one of them is run before it ships."
---

> Documentation Index
> Fetch the complete documentation index at: https://queenmq.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Full examples

The rest of this site shows the smallest fragment that makes a point. This section shows whole
programs: imports at the top, assertions at the bottom, nothing hidden. Copy one into a file and
it runs.

Three of them, in the order they are worth reading:

- [1. Produce and consume](/full-examples/produce-consume) — The smallest complete loop. Create a queue, push, consume with a group, acknowledge, and check every message arrived exactly once.
- [2. Ordering and deduplication](/full-examples/ordering-and-dedup) — One partition per entity, so each entity keeps its own order. Then the same push twice, and the broker refusing the second.
- [3. Transactional pipeline](/full-examples/pipeline) — Acknowledge one stage and push the next in a single database transaction, and watch a failed message come back rather than vanish.

Each is written three times, once per language, so you can read the one you use and compare it
against the one you do not.

## What "run before it ships" means here

The nine programs live in `examples/full/` in the repository. They are not transcribed into these
pages: the build extracts each file between its first and last line and includes it verbatim, so
what you read is the file that ran.

Every program asserts its own outcome and exits non-zero when an assertion fails. That is the
part that makes this claim worth anything: a program that only printed "ok" would prove nothing.

To run all nine yourself against a broker of your own:

```bash
QUEEN_URL=http://localhost:6632 examples/full/run.sh
```

The script checks the broker answers, installs the JavaScript dependencies on first use, and
prints a pass or fail line per program. It needs Node 22, Python 3.9 with `httpx`, and Go 1.24,
and it takes the clients from this repository rather than from the registries, so it exercises
the code in the tree rather than the last release.

> **Note**
>
> These programs use a queue name with a unique suffix per run rather than deleting and recreating
> a fixed one. That is deliberate and worth knowing about: deleting a queue and immediately
> recreating it under the same name currently leaves the broker with stale partition state for up
> to 30 seconds, during which deduplication silently does not deduplicate. Use fresh names, or wait,
> until that is fixed.

Source: https://queenmq.com/full-examples/index.mdx
