microservices question

I have a auth-service that stores users' credentials like emails, passwords etc. and user-service that stores users' profile info such as usernames, avatars, how do I handle user registration process? I have a gateway written using spring cloud gateway; when the user makes a request to register, they send an object with email, password and username, I want the email and the password to go to auth-service and username to go to user-service. Is it reasonable here to allow for communication between user-service and auth-service?
11 Replies
JavaBot
JavaBot2mo ago
This post has been reserved for your question.
Hey @IamMax420! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st2mo ago
I assume the auth service also needs the username? Then I'd guess first send it to the auth service, handle the authentication and if it succeeds, request the profile information
IamMax420
IamMax420OP2mo ago
doesn't that break the 'no communication between microservices' rule tho?
dan1st
dan1st2mo ago
There will need to be some sort of communication between microservices - the question is how you do that ofc it would also be possible for the auth service to return a JWT which can be verified by the user service
IamMax420
IamMax420OP2mo ago
maybe using a message queue here would work? the gateway produces 2 events to which auth service and user service are subscribed
dan1st
dan1st2mo ago
that is one way of communication between microservices just like REST is one way of doing that
IamMax420
IamMax420OP2mo ago
you're right, but I haven't dug that deep yet into microservices, is it generally not recommended for services to communicate with each other? or is it rather ok
dan1st
dan1st2mo ago
They need to communicate in some way but you should keep them decoupled message queues can make it easier to make them decoupled but they add complexity
IamMax420
IamMax420OP2mo ago
facts I'll think about REST or rabbitmq or something like that, thanks
JavaBot
JavaBot2mo ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
JavaBot
JavaBot2mo ago
Post Closed
This post has been closed by <@589517424093691905>.

Did you find this page helpful?