0

I am a newbie to microservice. Currently I'm learning microservices by creating 2 microservices with CQRS pattern, with NO event sourcing, but each service has separate DB. Each service has separate end points for Command and Query. There is no separate Read store and write store. The services communicate with each other via restend points.

From UI point of view, a Query restend point typically expects Paginated data. However when one service queries other service, the expected data need not be paginated. It just needs the data to continue the business logic (say to verify if an entity exists).

Is it ok to have two rest end points which pretty much does the same thing but the output format is different and purpose is different.

PS: This question is specific to the above implementation only (CQRS with no event sourcing and communication via restend points).

2
  • Similar to how you may have different endpoints for your customers and admin, it is also very common to have internal endpoints for communication between microservices directly - e.g. returning unpaginated results, not requiring user authentication,... This necessity comes directly from the fact that each microservice has its own database and you're likely required to synchronise data between them. Having dedicated internal endpoints is one of the possible solutions to achieve such synchronisation.
    – Andy
    Jun 8, 2021 at 10:05
  • I would expect the pagination to be implemented at the UI layer rather than the api. Its better for caching. But if the volume of data is too great then you are forced to paginate at the api
    – Ewan
    Jun 8, 2021 at 12:09

1 Answer 1

0

Is it ok to have two rest end points which pretty much does the same thing but the output format is different and purpose is different.

Yes.

What you are asking is analogous to the question of whether you can have two web pages with a different output format and purpose. And of course you can do that.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.