I have a controller that receives some REQUEST parameters. These are forwarded to an importer service class. The importer then connects to a remote REST api which in turn will respond with a list of resources.

Each resource must then be scanned for the existence of a certain property, and if it is present, a new request must be sent to the Api, using the value of that property. Finally, those resources will be persisted in a repository.

If my service connects to the api, scans the response object and sends a new request all at once, then it most likely violates SRP. I could move some parts of it into the domain layer. But I don't think the algorithm that processes the api response is a domain concern, it's more of a detail of the implementation.

So, should I create one service to send requests, and another to process the response? Or is it okay to create several methods within the same service?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.