Step 2 — Never processing twice

Redelivery is normal; an idempotent consumer makes it harmless.

← step 1 · step 3 →

Run it

One command, whichever language you came for. The image carries the library, the example built, its runtime and RabbitMQ; the management UI is on http://localhost:15672 (guest/guest) while it runs, and --keep holds it open afterwards.

docker run --rm -p 15672:15672 ghcr.io/acemq-company/acemq-tutorials-java:0.7.20 step 2
docker run --rm -p 15672:15672 ghcr.io/acemq-company/acemq-tutorials-python:0.7.17 step 2
docker run --rm -p 15672:15672 ghcr.io/acemq-company/acemq-tutorials-ruby:0.7.19 step 2
docker run --rm -p 15672:15672 ghcr.io/acemq-company/acemq-tutorials-dotnet:0.7.18 step 2
docker run --rm -p 15672:15672 ghcr.io/acemq-company/acemq-tutorials-go:0.9.14 step 2
docker run --rm -p 15672:15672 -e TUTORIAL_VARIANT=vbnet ghcr.io/acemq-company/acemq-tutorials-dotnet:0.7.18 step 2   # .NET in VB.NET

Side by side

Java Python Ruby .NET Go
Example 05-idempotent-consumer 02-idempotent-consumer 02-idempotent-consumer 03-idempotent-consumer-csharp (VB.NET) 02-idempotent-consumer
Tutorial: exactly once Java Python Ruby .NET Go
Reliability Java Python Ruby .NET Go

Java

acemq-java-amqp 0.7.20, acemq-java-amqp-examples examples-v0.7.20.

basic/05-idempotent-consumer

Every broker worth using delivers at least once. Duplicates are normal traffic, not an error, and handling one twice is your problem to prevent.

Python

acemq-python-amqp 0.7.17, acemq-python-amqp-examples examples-v0.7.17.

intermediate/02-idempotent-consumer

One logical payment delivered four times and charged once — and still once after a restart.

Ruby

acemq-ruby-amqp 0.7.19, acemq-ruby-amqp-examples examples-v0.7.19.

intermediate/02-idempotent-consumer

One logical message delivered four times, and one charge.

.NET

acemq-dotnet-amqp 0.7.18, acemq-dotnet-amqp-examples examples-v0.7.18.

basic/03-idempotent-consumer-csharp

One logical charge published three times under the same message id, its first delivery failed on purpose so the broker sends it again, and a consumer with an idempotency store in front of the handler that lets exactly one of them through to the card — because retries and at-least-once producers mean a message can arrive more than once, and a handler that changes anything has to be able to tell.

The VB.NET twin, basic/03-idempotent-consumer-vbnet, is the same program; -e TUTORIAL_VARIANT=vbnet runs it instead.

Go

acemq-go-amqp 0.9.14, acemq-go-amqp-examples examples-v0.9.14.

intermediate/02-idempotent-consumer

One charge is published three times with the same message id, and its first delivery fails on purpose and is retried, so the consumer receives it four times — and patterns.Idempotent makes sure the card is charged exactly once.