Generic spring-boot-starter-amqp (AmqpClient, @AmqpListener) and RabbitMQ's own AMQP 1.0 client against a real RabbitMQ 4.4.1 broker via Testcontainers. Transcripts in amqp10/output/ are written by the tests; no docs/ folder. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b44H98Yd627wauSpzA
48 lines
3.0 KiB
Markdown
48 lines
3.0 KiB
Markdown
# amqp10 — AMQP 1.0 in Spring Boot 4.2 with RabbitMQ 4
|
|
|
|
Companion code for the ankurm.com article *AMQP 1.0 in Spring Boot 4.2 with RabbitMQ 4*. Every
|
|
number in the article comes from a file in [`output/`](output), written by the test suite against a
|
|
real RabbitMQ broker started by Testcontainers.
|
|
|
|
| Piece | Version | Where it was read from |
|
|
|---|---|---|
|
|
| Spring Boot | 4.2.0 (GA 19 Nov 2026) | `maven-metadata.xml` |
|
|
| Spring Framework / Spring AMQP | 7.1.0 / 4.2.0 | Boot's dependency management |
|
|
| protonj2-client (generic AMQP 1.0) | 1.4.0 | `spring-boot-amqp` 4.2.0 pom |
|
|
| RabbitMQ AMQP 1.0 client | `com.rabbitmq.client:amqp-client` 1.7.0, via `spring-boot-starter-amqp-rabbitmq` 4.2.0 | resolved dependency tree |
|
|
| Broker | RabbitMQ 4.4.1 on Erlang 29.1.3 | `rabbitmq:4-management`, see `output/01-broker.txt` |
|
|
| JDK | Temurin 25.0.5.1 | |
|
|
| Testcontainers | 2.0.5 (`testcontainers-rabbitmq`) | Boot's BOM |
|
|
|
|
Boot 4.2 has three AMQP starters: `spring-boot-starter-amqp` (generic AMQP 1.0), `spring-boot-starter-amqp-rabbitmq`
|
|
(RabbitMQ's own AMQP 1.0 client) and `spring-boot-starter-rabbitmq` (classic AMQP 0-9-1). This module uses the first
|
|
two and talks to the third with a plain `RabbitTemplate` in the interop test.
|
|
|
|
## Run it
|
|
|
|
```bash
|
|
export JAVA_HOME=/path/to/jdk-25
|
|
./scripts/run-all.sh # needs Docker: Testcontainers starts rabbitmq:4-management
|
|
```
|
|
|
|
## What the tests show
|
|
|
|
| Test | Transcript | What it demonstrates |
|
|
|---|---|---|
|
|
| `Test01BrokerTest` | `01-broker.txt` | Broker version, enabled plugins: AMQP 1.0 needs no plugin on 4.x |
|
|
| `Test02GenericTest` | `02-generic-send-receive.txt`, `03-generic-pull-and-peek.txt` | `spring-boot-starter-amqp`: `AmqpClient` + `@AmqpListener`, how a message looks to the broker, and the untyped-pull trap that loses a message |
|
|
| `Test04AddressFailuresTest` | `04-address-failures.txt` | Which address forms work and what RELEASED / REJECTED mean |
|
|
| `Test05CredentialsTest` | `05-connection-mistakes.txt` | No credentials, wrong password, wrong port |
|
|
| `Test06RabbitClientTest` | `06-rabbit-client.txt` | `spring-boot-starter-amqp-rabbitmq`: auto-configured beans, declared topology, publish with confirms, `@RabbitListener` |
|
|
| `Test07InteropTest` | `07-classic-interop.txt` | One queue written by AMQP 0-9-1 and read by AMQP 1.0, and back |
|
|
| `Test08PoisonTest` | `08-poison-default.txt` | A throwing `@AmqpListener` kills its consumer under Boot's defaults |
|
|
| `Test09HandledTest` | `09-poison-with-error-handler.txt` | The same listeners with a container `ErrorHandler` |
|
|
| `scripts/compare-starters.sh` | `10-starter-comparison.txt` | What the two Boot starters contain, read from their jars |
|
|
|
|
Main sources: [`GenericOrderListener`](src/main/java/com/ankurm/amqp10/GenericOrderListener.java),
|
|
[`RabbitSpecificConfig`](src/main/java/com/ankurm/amqp10/RabbitSpecificConfig.java),
|
|
[`PoisonListeners`](src/main/java/com/ankurm/amqp10/PoisonListeners.java),
|
|
[`HandledFactoryConfig`](src/main/java/com/ankurm/amqp10/HandledFactoryConfig.java).
|
|
|
|
There is no `docs/` folder: the explanations live in the article's own collapsible sections.
|