Is it necessary to check the data of services between microservices in each process or can certain data errors be tolerated?
Service a user module
Service b comment module
When service b creates a comment, it needs the user to the user ID, user name and other basic user information, which are all passed to the background through the foreground as parameters. however, does it need to verify the existence of this user in service a through the user ID when creating the comment? ? ? Or insert directly into the database without checking? This will lead to the possibility that the current user does not exist in the system, but can create comments, causing the comment system to have wrong data? How to deal with this situation? ? ? ? ? ?
When you write a series of functions, it is probably not possible for every function to check whether all parameters conform to the context of this function, because this function can be considered to have passed the check of the previous function.
Whether Service B needs to check all parameters depends on whether Service B is an internal service or an external service and whether it deals directly with clients. If it is, then it must be verified perfectly. If not, it depends on whether the previous service has been fully verified and whether multiple business systems need to use this service.