I am using stubby4j to stub some service endpoints. I am currently stubbing the ones that are very heavy and not so complex to mock but I would like to call the real service for the rest of the endpoints.
Something like this:
/heavy-call-1 => stub service
/heavy-call-2 => stub service
/lightweight-call-1 => real service
/lightweight-call-2 => real service
Is there a way I can achieve this with this tool or should I consider using a different one?
You can actually make stubby call the real service and record the response for the first time, so the next requests will use this recorded response. The way you can do this is by specifying an URL in the body of the stubbed response in your yaml file like this:
You can find some more information in the stubby github docs: https://stubby4j.com/#key-features and https://stubby4j.com/docs/http_endpoint_configuration_howto.html#record-and-replay
Hope this helps!