{"id":30997048,"url":"https://github.com/mduesterhoeft/testing-asynchonous-interactions","last_synced_at":"2025-09-12T22:27:24.953Z","repository":{"id":99880588,"uuid":"78023059","full_name":"mduesterhoeft/testing-asynchonous-interactions","owner":"mduesterhoeft","description":"sample application code of the blog post Testing asynchronous interactions in distributed systems using Spring Cloud Contract published in the epages developer blog","archived":false,"fork":false,"pushed_at":"2017-02-06T12:07:03.000Z","size":72,"stargazers_count":10,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-10-20T21:44:14.043Z","etag":null,"topics":["rabbitmq","spring-amqp","spring-cloud-contract"],"latest_commit_sha":null,"homepage":"https://developer.epages.com/blog/2017/01/17/how-to-test-eventbased-services-using-contracts.html","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mduesterhoeft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-01-04T14:33:14.000Z","updated_at":"2023-10-20T21:44:14.681Z","dependencies_parsed_at":"2023-05-10T21:30:58.758Z","dependency_job_id":null,"html_url":"https://github.com/mduesterhoeft/testing-asynchonous-interactions","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/mduesterhoeft/testing-asynchonous-interactions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mduesterhoeft%2Ftesting-asynchonous-interactions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mduesterhoeft%2Ftesting-asynchonous-interactions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mduesterhoeft%2Ftesting-asynchonous-interactions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mduesterhoeft%2Ftesting-asynchonous-interactions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mduesterhoeft","download_url":"https://codeload.github.com/mduesterhoeft/testing-asynchonous-interactions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mduesterhoeft%2Ftesting-asynchonous-interactions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274886150,"owners_count":25368224,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rabbitmq","spring-amqp","spring-cloud-contract"],"created_at":"2025-09-12T22:27:18.143Z","updated_at":"2025-09-12T22:27:24.943Z","avatar_url":"https://github.com/mduesterhoeft.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Testing asynchronous interactions in distributed systems using Spring Cloud Contract\n\nThis 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](https://developer.epages.com/blog/2017/01/17/how-to-test-eventbased-services-using-contracts.html).\n\nIt illustrates how [Spring Cloud Contract](https://cloud.spring.io/spring-cloud-contract/) can be used to test asynchronous service interactions.\n\nPlease see the blog post for details.\n\n## Run the application\n\nA `docker-compose` setup exists to start the `product-service`, the `checkout-service`, and RabbitMQ.\n\nFirst build the services to generate the jar files. And then use `docker-compose` to start the services.\n\n```bash\ncd \u003ccheckout-directory\u003e/product-service\n./gradlew check bootRepackage\n```\n\nFor the product service we also need to make sure that the contracts have been published to the local maven repository.\n\n```bash\n./gradlew publishToMavenLocal\n```\n\n```bash\ncd \u003ccheckout-directory\u003e/checkout-service\n./gradlew check bootRepackage\n```\n\n```bash\ndocker-compose up -d\n```\n\n## Create a Product and add it to a cart\n\nWe use [httpie](https://github.com/jkbrzt/httpie) as command line HTTP client.\n\n*Create a product*\n\n```bash\nhttp POST \u003cdocker-ip\u003e:8081/products name=some salesPrice=49.99 purchasePrice=39.99\n```\n\n*Create a cart*\n\n```bash\nhttp POST \u003cdocker-ip\u003e:8082/carts\n```\nUse the uri in the location header for the next request\n\n*Add a product to the cart*\n\nThe product data should be available in the cart now and we should be able to add it.\n```bash\nhttp PUT \u003cdocker-ip\u003e:8082/carts/1 quantity=2 productId=1\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmduesterhoeft%2Ftesting-asynchonous-interactions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmduesterhoeft%2Ftesting-asynchonous-interactions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmduesterhoeft%2Ftesting-asynchonous-interactions/lists"}