This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java and have Dr. Raoul-Gabriel Urma & Richard Warburton on-line!
See this thread for details.
Win a copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Is this application developed by me a microservices application?

 
Ranch Hand
Posts: 1361
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I worked on an application where I needed to create API for sending notification which can be either email or sms. Instead of creating a single rest application having all responsibility , I decided to create 3 different Rest APIs (using spring boot) with different single responsibilities  such that the first API sends the Email, the second API sends SMS while the third API either calls the first or second API based on a parameter which tells whether user wants to send email or sms. So I have 3 different APIs under the same project having single responsibility. Is this application which I created a microservices application?

Thanks
 
Bartender
Posts: 21720
148
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds good to me.

Then again, if I had a single-contact web service API and it did the email and/or sms in the same app and that's all it did, I'd still count it as a micro-service.
 
Monica Shiralkar
Ranch Hand
Posts: 1361
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:
if I had a single-contact web service API and it did the email and/or sms in the same app and that's all it did, I'd still count it as a micro-service.



In microservice, each will be doing only 1 responsibility whereas here I can see that 1 api having 2 responsibilities that is sending sms as well as sending email. How can it be microservice in that case?
 
Tim Holloway
Bartender
Posts: 21720
148
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're looking at implementation. I'm looking at function. If the ultimate purpose is to send a message, regardless of transport and no other system calls the low-level transports directly, then it's not really necessary to make each one an independent app. Neither SMS nor email are all that big. And actually, I'd probably be using email to send SMS myself.
 
Monica Shiralkar
Ranch Hand
Posts: 1361
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.I was thinking that had I created single api in this case it would have been monolithic application and since I instead created 3 APIs which single responsibility, it is now microservice architecture. This is wrong as you said. So what would be an example of microsevices application as compared to example of monolithic application for the same functionality?

 
Tim Holloway
Bartender
Posts: 21720
148
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An API is not a single method definition, it's a set of related method interfaces. For example, the JEE API, which has interfaces full of methods for servlets, Http request and response objects, http sessions, and so forth.

What makes a microservice a microservice is primarily its function, not its construction. Basically, a microservice should do one thing and do it well. That doesn't mean that it cannot do one thing in many ways or even have many methods to talk to it, merely that it's primarily doing a single job and not a set of jobs the way a traditional web application with GUI web pages would.
 
Saloon Keeper
Posts: 6185
157
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're looking for hard and fast rules about what constitutes a microservice design, there are none. Or, depending on how you look at it, there are plenty :-) While Wikipedia isn't generally the best of sources for software engineering, it gets it just about right in the introduction to Microservices:


There is no single definition for microservices. A consensus view has evolved over time in the industry. Some of the defining characteristics that are frequently cited include:


And then it goes on. Specifically it says "Services are organized around business capabilities." So in your example, it would depend on whether the difference between sending a message via SMS or sending it via email is an important distinction for the business - which might or might not be the case. I think I'd side with Tim that functionality is key, and that this difference is not usually germane to that.
 
Monica Shiralkar
Ranch Hand
Posts: 1361
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:
What makes a microservice a microservice is primarily its function, not its construction.



In first case the function of first API is only to send email, the function of second API is only to send sms, the function of third API is only to call email/sms API based on user input. In the second case the function  of this single API is to decide whether to call sms or email api as well as calling the appropriate api.  
 
Tim Holloway
Bartender
Posts: 21720
148
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless I'm mis-reading, the only API actually seen by the AP (Application Program) is the one that determines which of the other 2 services to call. In which case, the only real business function is to send a message, irrespective of what transport will be chosen. There's no real benefit for breaking the backend services out into separate micro-services unless it's intended that they also be callable directly by application programs.
 
Monica Shiralkar
Ranch Hand
Posts: 1361
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:There's no real benefit for breaking the backend services out into separate micro-services unless it's intended that they also be callable directly by application programs.



Yes there is no benifit. I could have kept separate classes for smssender and emailsender and that would have been enough instead of different APIs. This is a wrong example of breaking into microsevices. What would be a right example for breaking into microservices?
 
Tim Holloway
Bartender
Posts: 21720
148
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd say that if the apps were combined into a single app that that would make an excellent example of a microservice.
 
Monica Shiralkar
Ranch Hand
Posts: 1361
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In microservices, instead of a big monolithic application it is broken down into multiple small services each having only 1 single responsibility.   These services communicate with each other.  Do these small services have to be under same project or separate project for each. Does these services communicating with each other mean one orchestrator service calling and using the other small services?
 
Monica Shiralkar
Ranch Hand
Posts: 1361
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks

Tim Holloway wrote:I'd say that if the apps were combined into a single app that that would make an excellent example of a microservice.



If I have a shopping cart application. In first case I break the application into 3 services. One applicaton for front-end , one application for APIs which are called from the front end applicaton and one applicaton for a notification API service application (used for sending notification to the customers) instead of having a single monolithic application having all these 3 in a single project.  Is this an example of microsevices?
 
Tim Moores
Saloon Keeper
Posts: 6185
157
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Monica Shiralkar wrote:Do these small services have to be under same project or separate project for each. Does these services communicating with each other mean one orchestrator service calling and using the other small services?


"Project" is not the important factor - a project could create multiple deployable artifacts (although I would consider that bad design, if the artifacts were independently deployable, and meant to be so). But yes - generally you would have multiple independently buildable and deployable artifacts in a microservice architecture.

In first case I break the application into 3 services. One applicaton for front-end , one application for APIs which are called from the front end applicaton and one applicaton for a notification API service application (used for sending notification to the customers) instead of having a single monolithic application having all these 3 in a single project.  Is this an example of microsevices?


I think you meant "3 applications" rather than "3 services". "frontend" could conceivably be quite big and monolithic, as can "APIs which are called from the front end applicaton". So whether that implements a microservice architecture is unclear form the details you have provided.
 
After some pecan pie, you might want to cleanse your palatte with this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!