When a group chat application on web assigns a URL for a chat room (www.myGroupChat.com/xyroom34) the link can be shared to others to invite, server would have to ensure that each URL postfix (xyroom34) has never been generated/assigned as a group, to tackle this I have 2 questions to be solved:
1: First problem can be minimized to generating unique UUIDs. Ample of solutions exist for this. Once such solution is using UUID
class. If your requirement is to generate it based on some pattern then it would be a better idea to create a separate microservice for it. One performance optimization you can also do is to generate 10000 UUIDs in advance and keep it in the cache or DB.
2: You can do that using PathVariables in spring.