When an issue is created in GitHub it has a unique identifier (like #1532) within a repository. How to implement this mechanism in a microservice architecture? Suppose I have 2 services Facilities and Issues, when an issue is created it must have a unique human-readable code within a certain facility.
I think that each time calling Facilities microservice to know the last code number is not a good idea.
Right now I'm thinking about using a queue like rabbitmq which would hold a facilityId and the last error code and update it every time the the code is requested.
I'm not quite sure about all the cons of such approach. Are there other better ways of solving this problem? Any help would be appreciated
UPDATE
I was also thinking about just storing facility ids and last codes in the database with initial values which seems like a good idea now