Skip to content

sample application code of the blog post Testing asynchronous interactions in distributed systems using Spring Cloud Contract published in the epages developer blog

Notifications You must be signed in to change notification settings

mduesterhoeft/testing-asynchonous-interactions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Testing asynchronous interactions in distributed systems using Spring Cloud Contract

This is a sample application code of the blog post Testing asynchronous interactions in distributed systems using Spring Cloud Contract published in the epages developer blog.

It illustrates how Spring Cloud Contract can be used to test asynchronous service interactions.

Please see the blog post for details.

Run the application

A docker-compose setup exists to start the product-service, the checkout-service, and RabbitMQ.

First build the services to generate the jar files. And then use docker-compose to start the services.

cd <checkout-directory>/product-service
./gradlew check bootRepackage

For the product service we also need to make sure that the contracts have been published to the local maven repository.

./gradlew publishToMavenLocal
cd <checkout-directory>/checkout-service
./gradlew check bootRepackage
docker-compose up -d

Create a Product and add it to a cart

We use httpie as command line HTTP client.

Create a product

http POST <docker-ip>:8081/products name=some salesPrice=49.99 purchasePrice=39.99

Create a cart

http POST <docker-ip>:8082/carts

Use the uri in the location header for the next request

Add a product to the cart

The product data should be available in the cart now and we should be able to add it.

http PUT <docker-ip>:8082/carts/1 quantity=2 productId=1

About

sample application code of the blog post Testing asynchronous interactions in distributed systems using Spring Cloud Contract published in the epages developer blog

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published