My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Micro-services

Sarosh Tariq's photo
Sarosh Tariq
·Nov 9, 2019

Lets say we have to develop two microservices one is pay your bill from mobile phone using your bank account and other is transfer cash to a friend using your bank account. Now, both these services will need multiple requests to be completed.

Pay bill:

  • Verify user
  • Fetch bill amount
  • Verify user with transaction pin
  • Pay Bill

Transfer Money:

  • Verify user
  • Verify recipient account
  • Verify user with transaction pin
  • Transfer money

Now what I am unable to understand is that if we develop these micro-services in spring boot,

Do we have to make two different jars for both?

If yes than that will need repeating the code. But at the same time we need the control that if one micro-service has greater TPS than we can like run two instances of that service and keep the other one same(we are going to be using kubernetes for that) but again if you run two jars you have to run them at different ports and than keep mapping of there ports and endpoints at the another place because we need to keep the URL for all the micro-services same. As I have read on Wikipedia about micro-service an application as a collection of loosely coupled services so that means multiple JARs solution is correct but than I am confused that like its really unnecessary to make two same codes which have authentication, security everything repeated and please remember we are thinking of developing like 12 of these services. This may seem like stupid question but please remember this is completely new for me. So to put it simply,

Are micro-services divided into different modules, running on different ports??

About Me

I am a Software Engineer and have 9 months of experience working at a Software Solution Provider company. I have developed WPF, Angular4, JavaFx in front end and Spring Boot, ExpressJs REST APIs. This is just to give you a context of my current knowledge.