Link to home
Start Free TrialLog in
Avatar of Software Programmer
Software Programmer

asked on

Controller and Service Methods or Controller Alone

I went through the URL - https://dzone.com/articles/quick-guide-to-microservices-with-kubernetes-sprin where both the controller and the service methods are exposed as REST API's

The confusion comes and raises the question whether we need to expose controller methods as REST APIs or Service methods are APIS

if we make both of them as REST APIs then when we call a controller methods - 2 HTTP request might be sent and will cause performance issue.

Please advise.
Avatar of Sathish David  Kumar N
Sathish David Kumar N
Flag of India image

Rest Api expose only controller not services class
but as per my understanding they are mention each micro services as called service
Avatar of Software Programmer
Software Programmer

ASKER

@Sathish David Kumar N - so when we define micro services, can we define service as REST API ???
No , Your confused with word services .

Let me tell you clearly .  take flipkart create 3 micro services .  1. user details , 2. product display 3. payment

this 3 we will called as services . its  3 different project  but deployed in one container .  each one will have own REST API that will call controller .

if you select product and call payment it will go to the particular class .

I think it will give some idea ?
What is the advantages of having 3 services in one container ? Pls explain in detail

Assume Windows 10 have several services. We can start or stop a particular service on need.

Can we start/stop a service in a microservice architecture which is being deployed in a one container?

Is the each service will have separate tomcat server ???? pls help me to understand
Think all 3 are together the n ,If any problem occur the whole site will down ,
But in micro services (as per above example 3 services) if any one down also other 2 will work  so the site will still run.

all there are different different war we can deploy as per our wish but mostly all 3 are in one server
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.