/contract-test-sample

A sample spring boot application to demonstrate spring-cloud-contract for amqp based applications

Primary LanguageJava

Spring Cloud Contract based AMQP application

This application is created as simple as possible. It uses spring-cloud-contract to verify the message contract at publisher and consumer side

What does the application contain

  1. A Producer application to publish a message to amqp
  2. A Consumer application to receive the message

Spring cloud contract integration

On Producer side

  1. Producer contains the contract definition (under test/resources/contracts)
  2. BaseTest class for contract tests publish message to Amqp
  3. ContractVerifierTest (auto generated) will verify the contract

On Consumer side

  1. Consumer downloads the stubs from local repo
  2. The only test will trigger the stub using label
  3. Asserts the contract

Additional points to notice

  1. If spring-cloud-starter-bus-amqp is used instead of spring-boot-starter-amqp, you need to disable stream as follows to get rid of the error No bean named '<your-exchange-name>' available
stubrunner.stream.enabled=false
  1. If opentracing-spring-jaeger-cloud-starter or any similar tracing is on classpath, you need to disable them as follows to get rid of the error StubRunner AMQP will work only if RabbiTemplate is a spy
opentracing.spring.rabbitmq.enabled=false