- Run local RabbitMQ docker
docker run --rm -it --hostname my-rabbit -p 15672:15672 -p 5672:5672 rabbitmq:3-management
- Run local Zipkin docker
docker run -d -p 9411:9411 openzipkin/zipkin
-
Now you can run DemoApplication.java
-
As observed, the trace will be enabled when the log level is set to DEBUG
For further reference, please consider the following sections:
- Official Apache Maven documentation
- Spring Boot Maven Plugin Reference Guide
- Create an OCI image
- Testcontainers RabbitMQ Module Reference Guide
- Sleuth
- Cloud Stream
- Spring for RabbitMQ
- Testcontainers
The following guides illustrate how to use some features concretely:
2022-07-26 11:20:21.771 DEBUG [,,] 19627 --- [ main] o.s.amqp.rabbit.core.RabbitTemplate : Publishing message [(Body:'key-1;value-1' MessageProperties [headers={b3=57538165580910d3-57538165580910d3-0}, contentType=text/plain, contentEncoding=UTF-8, contentLength=13, deliveryMode=PERSISTENT, priority=0, deliveryTag=0])] on exchange [rmq-test-exchange], routingKey = [foo.one.baz]
2022-07-26 11:20:21.777 DEBUG [,,] 19627 --- [ container-1] o.s.a.r.listener.BlockingQueueConsumer : Received message: (Body:'key-1;value-1' MessageProperties [headers={b3=57538165580910d3-57538165580910d3-0}, contentType=text/plain, contentEncoding=UTF-8, contentLength=0, receivedDeliveryMode=PERSISTENT, priority=0, redelivered=false, receivedExchange=rmq-test-exchange, receivedRoutingKey=foo.one.baz, deliveryTag=1, consumerTag=amq.ctag-PB-GQ9HB6MOWVVaPVqawTg, consumerQueue=rmq_test_queue_one])
2022-07-26 11:17:05.826 DEBUG [,,] 19519 --- [ main] o.s.amqp.rabbit.core.RabbitTemplate : Publishing message [(Body:'key-1;value-1' MessageProperties [headers={}, contentType=text/plain, contentEncoding=UTF-8, contentLength=13, deliveryMode=PERSISTENT, priority=0, deliveryTag=0])] on exchange [rmq-test-exchange], routingKey = [foo.one.baz]
2022-07-26 11:17:05.829 DEBUG [,,] 19519 --- [ container-1] o.s.a.r.listener.BlockingQueueConsumer : Received message: (Body:'key-1;value-1' MessageProperties [headers={}, contentType=text/plain, contentEncoding=UTF-8, contentLength=0, receivedDeliveryMode=PERSISTENT, priority=0, redelivered=false, receivedExchange=rmq-test-exchange, receivedRoutingKey=foo.one.baz, deliveryTag=2, consumerTag=amq.ctag-SaKuyTMGuohNVL4z_ZGHuQ, consumerQueue=rmq_test_queue_one])