/pact-msg

Example of asynchronous pact contract testing for message queues

Primary LanguageKotlin

An example project to demonstrate asynchronous contract testing

This is an example of how to use Pact for contract testing between two services that are separated by a queue. The version 3 of the Pact Specification introduces interactions for services that communicate via message queues.

The project consists of a producing service, the checkout-service and two consuming services, a fulfillment-service and a billing-service.

The checkout-service produces orders and sends them to a queue. These orders are picked up by the two other services. The fulfillment-service is interested in the item names and the customerId and the billing-services sums up the prices of the individual items. The second service is the fulfilment-service which is able to consume orders.

Message passing is done via Testcontainers which provides a mock for Amazon's Simple Queueing Service (SQS).

Conceptual drawing