4. References
Microservices
(Newman 2021) Newman, Sam. Building Microservices (2ed). O’Reilly, 2021.
https://www.amazon.co.uk/Building-Microservices-Second-Sam-Newman/dp/1492034029/
(Richardson 2019) Richardson, Chris. Microservice Patterns: With examples in Java. Manning, 2019.
https://www.amazon.co.uk/Microservice-Patterns-examples-Chris-Richardson/dp/1617294543/
4
CSU33012 Goetz Botterweck
5. References
Design of Data-Intensive Distributed Systems
(Kleppmann 2016) Kleppmann, Martin. Designing Data-Intensive Applications: The Big Ideas Behind Reliable,
Scalable, and Maintainable Systems. O’Reilly, 2016.
https://www.amazon.co.uk/Designing-Data-Intensive-Applications-Reliable-Maintainable/dp/1449373321/
5
CSU33012 Goetz Botterweck
6. References
Spring Boot
(Turnquist 2022) Turnquist, Greg L. Learning Spring Boot 3.0: Simplify the development of
production-grade applications (3ed). Packt, 2022.
ISBN 978-1803233307
https://www.amazon.co.uk/Learning-Spring-Boot-3-0-production-grade/dp/1803233303/
(Larsson 2023) Larsson, Magnus. Microservices with Spring Boot 3 and Spring Cloud:
Build resilient and scalable microservices using Spring Cloud, Istio, and
Kubernetes. Packt, 2023.
ISBN 978-1805128694
https://www.amazon.co.uk/Microservices-Spring-Boot-Cloud-microservices/dp/1805128698/
(Heckler 2021) Heckler, Mark. Spring Boot: Up and Running: Building Cloud Native Java
and Kotlin Applications. O’Reilly, 2021.
ISBN 978-1492076988
https://www.amazon.co.uk/Spring-Boot-Running-Building-Applications/dp/1492076988
6
CSU33012 Goetz Botterweck
7. References
Spring Boot (Further Reading)
(Walls 2015) Walls, Craig. Spring Boot in Action. Manning, 2015.
ISBN 978-1617292545
https://www.amazon.co.uk/Spring-Boot-Action-Craig-Walls/dp/1617292540/
(Somewhat dated)
(García 2020) García, Moisés Macero. Learn Microservices with Spring Boot: A
Practical Approach to RESTful Services Using an Event-Driven
Architecture, Cloud-Native Patterns, and Containerization. Apress, 2020
ISBN 978-1484261309
https://www.amazon.co.uk/Learn-Microservices-Spring-Boot-Containerization/dp/1484261305/
(new edition coming 13 December 2023)
7
CSU33012 Goetz Botterweck
10. Microservices
• Architectural style
• Structures application as a
collection of small autonomous
services
• Key Characteristics
• Single Responsibility: Each service
focuses on a single functionality
• Independence: developed,
deployed, and scaled separately
• Decentralized
• Autonomy: self-contained and
manages its own data.
CSU33012 Goetz Botterweck 10
Image: tutorialspoint.com
11. • To be completed
CSU33012 Goetz Botterweck 11
14. HyperText Transfer Protocol (HTTP)
• Rules for the communication between web browser and web server
• Transporting hypertext content to the web browser
• Client-server model (request-response)
• Stateless
• Server does not remember any information about the client (in the basic
model)
• Challenging for application developers
• How do you store state (e.g., a shopping cart)?
• How do you track what users are doing (e.g., click path through the website)?
• How do you know that it‘s a authorized user?
https://developer.mozilla.org/en-US/docs/Web/HTTP
https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview
CSU33012 Goetz Botterweck 14
23. Typical 4 Phases in Client-Server Protocols
1. The server "listens", it opens a TCP socket and waits for a
connection.
2. The client establishes a connection to the server.
3. The client sends a request.
4. The server processes the request and sends a response.
This is a common pattern, based on the TCP/IP Stack, oriented on a
request-response model. There are other variants.
CSU33012 Goetz Botterweck 23
24. 1. Server Listens
• The server opens a socket (identified by an IP address and a TCP port)
and binds to that. The server "listens" on that port.
• For instance, port 80 on IP 18.66.171.91 (one of the servers providing
www.tcd.ie).
• Hence, it will be informed by the operating system when a new
connection comes in.
• Different ports = Different types of services
• e.g., traditionally HTTP on port 80, SMTP on port 25, etc.
• Different ports = Different instances of a service
• e.g., port 80 public web server, port 81 development web server
• Same port = Different instances a service, e.g., multiple websites
CSU33012 Goetz Botterweck 24
25. 2. Client Connects
• The client might have to lookup the IP address from a domain name.
• e.g. www.tcd.ie → 18.66.171.91
• The client opens a TCP connection to the server's socket (IP address +
TCP port)
• On the client-side the connection also has a socket (IP address + TCP
Port).
• The port is often automatically generated for the connection.
• Together the two sockets (source IP, source port, dest. IP, dest. port) uniquely
identify the connection.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Session#Establishing_a_connection
CSU33012 Goetz Botterweck 25
26. 3. Client Sends Request
• HTTP request consists of text
lines, separated by CRLF.
• Method + Path + Protocol
• HTTP Header
• Data Block (Optional), mainly used
by POST Method
https://developer.mozilla.org/en-
US/docs/Web/HTTP/Session#Sending_a_client_request
GET / HTTP/1.1
Host: developer.mozilla.org
Accept-Language: fr
(empty line to end header)
CSU33012 Goetz Botterweck 26
27. 3. Client Sends Request
• Request Methods
GET request a data representation
of the request
POST send data to the server, so
that it may change its state;
mostly used by HTML forms
https://developer.mozilla.org/en-
US/docs/Web/HTTP/Session#Sending_a_client_request
POST /contact_form.php HTTP/1.1
Host: developer.mozilla.org
Content-Length: 64
Content-Type: application/x-www-form-urlencoded
name=Joe%20User&request=Send%20me%20one%20of%20you
r%20catalogue
CSU33012 Goetz Botterweck 27
28. 4. Server Processes Request, Sends Response
• A HTTP response consists of text
lines, separated by CRLF.
• Status line: Protocol + Status (incl.
a brief human-readable status)
• HTTP Header
• Data Block (Optional)
https://developer.mozilla.org/en-
US/docs/Web/HTTP/Session#Sending_a_client_reque
st
HTTP/1.1 200 OK
Date: Sat, 09 Oct 2010 14:28:02 GMT
Server: Apache
(more headers)
Content-Length: 29769
Content-Type: text/html
(empty line to end header)
<!DOCTYPE html...
CSU33012 Goetz Botterweck 28
29. 4. Server Processes Request, Sends Response
HTTP/1.1 200 OK
Date: Sat, 09 Oct 2010 14:28:02 GMT
Server: Apache
Last-Modified: Tue, 01 Dec 2009 20:18:22 GMT
ETag: "51142bc1-7449-479b075b2891b"
Accept-Ranges: bytes
Content-Length: 29769
Content-Type: text/html
<!DOCTYPE html... (here comes the 29769 bytes of the requested web page)
CSU33012 Goetz Botterweck 29
30. 4. Server Processes Request, Sends Response
HTTP/1.1 301 Moved Permanently
Server: Apache/2.2.3 (Red Hat)
Content-Type: text/html; charset=iso-8859-1
Date: Sat, 09 Oct 2010 14:30:24 GMT
Location: https://developer.mozilla.org/ (this is the new link to the resource; it is expected that the user-agent
will fetch it)
Keep-Alive: timeout=15, max=98
Accept-Ranges: bytes
Via: Moz-Cache-zlb05
Connection: Keep-Alive
X-Cache-Info: caching
X-Cache-Info: caching
Content-Length: 325 (the content contains a default page to display if the user-agent is not able to follow the
link)
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://developer.mozilla.org/">here</a>.</p>
<hr>
<address>Apache/2.2.3 (Red Hat) Server at developer.mozilla.org Port 80</address>
</body></html>
CSU33012 Goetz Botterweck 30
31. 4. Server Processes Request, Sends Response
HTTP/1.1 404 Not Found
Date: Sat, 09 Oct 2010 14:33:02 GMT
Server: Apache
Last-Modified: Tue, 01 May 2007 14:24:39 GMT
ETag: "499fd34e-29ec-42f695ca96761;48fe7523cfcc1"
Accept-Ranges: bytes
Content-Length: 10732
Content-Type: text/html
<!DOCTYPE html... (contains a site-customized page helping the user to
find the missing resource)
CSU33012 Goetz Botterweck 31
34. HTTP Status
1xx Informational Response
• 100 Continue
• 101 Switching Protocols – Server has agreed to switch protocols
• 102 Processing – Still working on it, don't time out
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
CSU33012 Goetz Botterweck 34
35. HTTP Status
2xx Success
• 200 OK – Standard response for successful HTTP requests.
• 201 Created – Request fulfilled, resulting in the creation of a new
resource.
• 202 Accepted – Request accepted for processing, but the processing
has not been completed.
• 203 Non-Authoritative Information (since HTTP/1.1) – Returning
modified content.
• …
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
CSU33012 Goetz Botterweck 35
36. HTTP Status
3xx Redirection
• …
• 301 Moved Permanently – This and all future requests should be
directed to the given URI
• …
• 304 Not Modified – You can use the cached copy that you have.
• …
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
CSU33012 Goetz Botterweck 36
37. HTTP Status
4xx Client Error
• 400 Bad Request
• 401 Unauthorized (RFC 7235)
• …
• 403 Forbidden
• 404 Not Found
• …
• 418 I'm a teapot (RFC 2324)
• …
• 451 Unavailable For Legal Reasons (RFC 7725) – See Fahrenheit 451
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
CSU33012 Goetz Botterweck 37
38. HTTP Status
5xx Server Error
• 500 Internal Server Error
• …
• 503 Service Unavailable
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
CSU33012 Goetz Botterweck 38
39. HTTP Methods (Verbs)
• GET – Fetch a URL
• HEAD – Fetch information about a URL
• PUT – Store to an URL
• PATCH – Partial modification of resource at an URL
• POST – Send form data to a URL and get a response back
• DELETE – Delete a URL
CSU33012 Goetz Botterweck 39
41. REST
• Representational State Transfer
• architectural style for designing networked applications
• defines a way to provide an “interface”
• Roy Fielding (2000)
• Uses HTTP requests to trigger data operations
• POST (create)
• PUT (update)
• PATCH (partial update)
• GET (read)
• DELETE (erase)
CSU33012 Goetz Botterweck 41
42. Key Principles of REST
• Client-Server Architecture
• Client and server are independent
• Can evolve separately
• Statelessness
• Each HTTP request contains all information needed to process it
• Server does not retain any information
• Cacheability
• Responses can be explicitly marked as cacheable or non-cacheable
• Uniform Interface
• Resource Identification (URI)
• Self-descriptive messages - each HTTP request contains all information
needed to process it (see Statelessness)
CSU33012 Goetz Botterweck 42
43. Data Representation in RESTful APIs
• JSON (JavaScript Object Notation)
• XML (Extensible Markup Language)
CSU33012 Goetz Botterweck 43