0% found this document useful (1 vote)
317 views

Spring Microservices Presentation

This document discusses microservices and web services. It defines microservices as small, autonomous services that work together, and notes the challenges of configuration management, dynamic scaling, and visibility. It then discusses solutions like Spring Cloud Config and Eureka for centralized configuration and service discovery. The document also discusses web services, defining them as software systems for machine-to-machine interaction over a network. It compares SOAP and REST-based web services, noting differences in data formats, service definitions, and transports. Finally, it discusses best practices for RESTful design like using HTTP methods and status codes appropriately.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
317 views

Spring Microservices Presentation

This document discusses microservices and web services. It defines microservices as small, autonomous services that work together, and notes the challenges of configuration management, dynamic scaling, and visibility. It then discusses solutions like Spring Cloud Config and Eureka for centralized configuration and service discovery. The document also discusses web services, defining them as software systems for machine-to-machine interaction over a network. It compares SOAP and REST-based web services, noting differences in data formats, service definitions, and transports. Finally, it discusses best practices for RESTful design like using HTTP methods and status codes appropriately.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 114

SPRING

MICROSERVICES
MICROSERVICES
Small autonomous services that work
together - Sam Newman
In short, the microservice architectural
style is an approach to developing a
single application as a suite of small
services, each running in its own
process and communicating with
lightweight mechanisms, o en an
HTTP resource API....contd
These services are built around
business capabilities and
independently deployable by fully
automated deployment
machinery...contd
There is a bare minimum of centralized
management of these services, which
may be written in different
programming languages and use
different data storage technologies -
James Lewis and Martin Fowler
MICROSERVICES
REST
& Small Well Chosen Deployable Units
& Cloud Enabled
HOW DOES IT LOOK?
CHALLENGES
BOUNDED CONTEXT
CONFIGURATION
MANAGEMENT
DYNAMIC SCALE UP
AND SCALE DOWN
VISIBILITY
PACK OF CARDS
SOLUTIONS
CENTRALIZED CONFIGURATION
MANAGEMENT
Spring Cloud Config Server
LOCATION TRANSPARANCY
Naming Server (Eureka)
LOAD DISTRIBUTION
Ribbon (Client Side)
VISIBILITY AND MONITORING
Zipkin Distributed Tracing
Netflix API Gateway
FAULT TOLERANCE
Hystrix
Microservices
Microservices Environments
Currency Conversion Service
Currency Exchange Service
Eureka Naming Server
Ribbon Load Balancing
Spring Cloud Config Server
Zipkin Distributed Tracing
API GATEWAYS
Authentication, authorization and security
Rate Limits
Fault Tolerance
Service Aggregation
WEB SERVICE
Service delivered over the web?
Is the Todo Management Application a
Web Service?

It delivers HTML output - Not consumable by other


applications.
Can I reuse the Business Layer by creating a JAR?
Not Platform independent
Communication of Changes
Managing Dependencies - like Database
How can I make my Todo application
consumable by other applications?
That where we get into the concept of a
web service!
WEB SERVICE - W3C DEFINITION
So ware system designed to support
interoperable machine-to-machine
interaction over a network.
3 KEYS
Designed for machine-to-machine (or application-
to-application) interaction
Should be interoperable - Not platform dependent
Should allow communication over a network
HOW?
How does data exchange between
applications take place?
How can we make web services
platform independent?
XML
<getCourseDetailsRequest>
<id>Course1</id>
</getCourseDetailsRequest>
JSON
[
{
"id": 1,
"name": "Even",
"birthDate": "2017-07-10T07:52:48.270+0000"
},
{
"id": 2,
"name": "Abe",
"birthDate": "2017-07-10T07:52:48.270+0000"
}
]
How does the Application A know the
format of Request and Response?
How does Application A and Web
Service convert its internal data to (XML
or JSON)?
KEY TERMINOLOGY
Request and Response
Message Exchange Format
XML and JSON
KEY TERMINOLOGY
Service Provider or Server
Service Consumer or Client
Service Definition
KEY TERMINOLOGY
Transport
HTTP and MQ
WEB SERVICE GROUPS
SOAP-based
REST-styled
SOAP and REST are not really
comparable.
SOAP
SOAP?

<getCourseDetailsRequest>
<id>Course1</id>
</getCourseDetailsRequest>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ns2:getCourseDetailsResponse xmlns:ns2="http://in28minutes
<ns2:course>
<ns2:id>Course1</ns2:id>
<ns2:name>Spring</ns2:name>
<ns2:description>10 Steps</ns2:description>
</ns2:course>
</ns2:getCourseDetailsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
SOAP
Format
SOAP XML Request
SOAP XML Response
Transport
SOAP over MQ
SOAP over HTTP
Service Definition
WSDL
WSDL
REST
REpresentational State Transfer
REST is a style of so ware architecture
for distributed hypermedia systems
MAKE BEST USE OF HTTP
KEY ABSTRACTION - RESOURCE
A resource has an URI (Uniform Resource Identifier)
/users/Ranga/todos/1
/users/Ranga/todos
/users/Ranga
A resource can have different representations
XML
HTML
JSON
EXAMPLE
Create a User - POST /users
Delete a User - DELETE /users/1
Get all Users - GET /users
Get one Users - GET /users/1
REST
Data Exchange Format
No Restriction. JSON is popular
Transport
Only HTTP
Service Definition
No Standard. WADL/Swagger/...
REST VS SOAP
Restrictions vs Architectural Approach
Data Exchange Format
Service Definition
Transport
Ease of implementation
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ns2:GetCourseDetailsRequest xmlns:ns2="http://in28minutes.
<ns2:id>Course1</ns2:id>
</ns2:GetCourseDetailsRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ns2:GetCourseDetailsResponse xmlns:ns2="http://in28minutes
<ns2:CourseDetails>
<ns2:id>Course1</ns2:id>
<ns2:name>Spring</ns2:name>
<ns2:description>10 Steps</ns2:description>
</ns2:CourseDetails>
</ns2:GetCourseDetailsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
RICHARDSON
MATURITY MODEL
LEVEL 0
EXPOSE SOAP WEB SERVICES IN
REST STYLE
http://server/getPosts
http://server/deletePosts
http://server/doThis
LEVEL 1
EXPOSE RESOURCES WITH
PROPER URI
http://server/accounts
http://server/accounts/10
NOTE : IMPROPER USE OF HTTP
METHODS
LEVEL 2
LEVEL 1 + HTTP METHODS
LEVEL 3
LEVEL 2 + HATEOAS
DATA + NEXT POSSIBLE ACTIONS
BEST PRACTICES IN
RESTFUL DESIGN
CONSUMER FIRST
MAKE BEST USE OF
HTTP
REQUEST METHODS
GET
POST
PUT
DELETE
RESPONSE STATUS
200 - SUCCESS
404 - RESOURCE NOT FOUND
400 - BAD REQUEST
201 - CREATED
401 - UNAUTHORIZED
500 - SERVER ERROR
NO SECURE INFO IN
URI
USE PLURALS
Prefer /users to /user
Prefer /users/1 to /user/1
USE NOUNS FOR
RESOURCES
FOR EXCEPTIONS
DEFINE A CONSISTENT
APPROACH
/search
PUT /gists/{id}/star
DELETE /gists/{id}/star
CONSUMER FIRST
ARCHITECTURAL
STANDARDS
DEFINE ORGANIZATIONAL
STANDARDS
YARAS - https://github.com/darrin/yaras
NAMING RESOURCES
REQUEST RESPONSE
STRUCTURES
COMMON FEATURES
STANDARDIZATION
Error Handling
Versioning
Searching
Filtering
Support for Mock Responses
HATEOAS
BUILD A FRAMEWORK
FOCUS ON DECENTRALIZED
GOVERNANCE

You might also like