java - Microservices communication -


i'm studying microservices , i'm facing problem.

context

i m developing 2 microservices :

  • user management, spring based, mysql database
  • planning management, asp.net based sql server database. access point of service api listing restful endpoints /planning/{day}/{userid} or /planning/{startdate}/{enddate}/{iduser}
  • billing management, node.js based mongodb.

problems

  1. what can permit accessing planning information through user service without couple 2 services ? knowing planning service accessed later somewhere else, not now.

  2. how can access billing information billing service corresponding user mysql database? know microservices not coupled, , point killing me, cause has coupled in way no? referencing iduser in billing? else, how can know billing api should expose? more precisely, how microservices communicate between them, without coupled?

  3. how create authentication without duplicating authentication requests authentication service, other services?

the important thing recognize here that, when comes implementing user authentication, user authorization, , user session management solutions, there aren't significant conceptual differences between solutions micro-service architecture , other form of distributed systems architecture.

conceptually, solution implementation of kerberos protocol, notion of "ticket" (or "token" more commonly called today) being passed around establish identity of users.

so in case, user management service serve backend authentication , authorization server, other services need aware. user management service responsible issuing , verifying user tokens establish users' identity , roles.

what can permit accessing planning information through user service without couple 2 services?

when user tries access .net service, service have rely on user management service establish user's identity. in other words, .net service need know user management service (i.e. url). can utilize tools etcd or nats propagate location of user management service rest of ecosystem, without coupling microservices it.

how can access billing informations billing service corresponding user mysql database?

the simplest solution pass in (single?) key (say user id) query parameter in url of billing service. of course, billing service has implemented in such way expect key being appended url. if have additional keys need included (say example, billing dates, order status etc.), maybe can utilized either memcached or redis store information @ runtime. of course, have consider trade-offs of adding these single-point-of-failure ecosystem :-)

how create authentication without duplicating authentication requests authentication service, other services?

again, once user authenticated, identity information can stored in either memcached or redis avoid repeating authentication , authorization process.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

node.js - How to abort query on demand using Neo4j drivers -