Skip to content

Latest commit

 

History

History

spring-boot-rabbitmq

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Integration testing with Spring Boot, RabbitMQ, Testcontainers and JUnit5

Simple example demonstrating how testcontainers, RabbitMQ and JUnit 5 can play together.

A simple test will be converted into JSON and send by RabbitSender.kt to rabbit. Message will be received by RabbitReceiver.kt.

Used technologies

  • Spring Boot >= 3.0.x
  • Kotlin >= 1.7.x
  • Rabbit 3
  • Testcontainers >= 1.17.x
  • JUnit >= 5.9.x

Requirements

  • Java 17
  • Maven >= 3.2.1 (Kotlin comes as maven dependency)
  • Docker >= 3.0 (for integration tests)
Clone repository and build project

Integration test RabbitIT will be started in maven phase verify.

$ git clone https://github.com/larmic/spring-boot-demos
$ mvn clean verify -f spring-boot-rabbitmq
Local testing
# start local rabbit
$ docker compose -f misc/rabbitmq/docker-compose.yml up -d

# start application
$ mvn spring-boot:run

# Post a new message
$ curl -i -H "Content-Type: text/plain" --request POST --data 'hello, this is a rabbit message!' http://localhost:8080/