-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about testing request/async response #2069
Comments
Hey Chris! We came to the conclusion that the input / output case is indeed a set of two scenarios.
Service A produces, service B consumes. Service B produces, service A consumes. From the point of view of supporting the framework we've decided to limit to this one particular case (code triggers message) because supporting the code to generate all the fake routing mechanisms and fake listener creation was super hard to maintain with a lot of different edge cases.
Correct, the output side that was previously in the input / output now must be moved as a contract on the consumer side. |
Interesting. This appear straightforward with Eventuate but I guess supporting multiple brokers could get tricky. |
Key question: how to code generate for multiple dependencies + the service. AFAIK The verifier plugin appears to only support code generating from a single contracts JAR/dependency. |
Yeah, we don't really support that. The only thing that comes to my mind is to make the group id and artifact id parametrizable and run the build multiple times. Can you please file an enhancement request? That wouldn't be so difficult to implement (famous last words). OTOH you can store all the contracts in one place and store them via e.g. topics. Then you would generate them all from a single place. |
IMHO
I think it would be better to enhance the plugin to support code generation from multiple "sources" for the contracts. |
So if we added that feature to support multiple sources for contracts, would that solve the problems with this type of communication? |
Most likely |
Request/async response is similar to HTTP except that it's message-based:
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 anoutput
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
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
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?
The text was updated successfully, but these errors were encountered: