Description
Request/async response is similar to HTTP except that it's message-based:
- Client sends an command message to the service
- Service sends back a reply message
The service owns the schema of the request and reply messages.
Older versions of Spring Cloud Contract supported request/async response fairly easily. See ConfirmCreateTicket.groovy.
The contract had input and output messages.
But, as far as I can figure out, in the more recent versions of Spring Cloud Contract, a contract for a message consists of an input/triggeredBy
trigger and an output
message.
Consequently, there are separate contracts for the request and reply messages.
From Spring Cloud Contract's perspective, the service is a producer of a replies and a consumer of requests.
The service/producer-side tests consist of
- Code generated tests for the reply contracts
- Stub runner tests for the service's request (not the client's) contracts
Similarly, from Spring Cloud Contract's perspective, the client is a producer of requests and a consumer of replies.
The consumer-side tests consist of
- Code generated tests (from the provider/service contracts - not its own contracts) for the request contracts
- Stub runner tests for the service's reply contracts
This is doable but a bit awkward.
One notable challenge, however, is that the consumer-side needs to have code generated tests for every service that it invokes asynchronously (as well as its own contracts).
Thoughts?