SlideShare a Scribd company logo
REST VS. MessagingIntegration Approaches for Microservices
Eberhard Wolff
/ ewolff / olivergierke
Oliver Gierke
Microservices
2
ECommerce
Order Customer
Delivery
Order Customer
Delivery
Package WAR
Integration
3
UI
Logic
Data
Links Modular UI
REST Messaging
Replication
No Common

Schema!
Overview
4
REST
• Architectural style
• Constraints in architecture result in
traits of the system
• Identifiable resources, uniform
interface, representations,
hypermedia
• Synchronous by default
5
?
Microservice
Microservice
REST
• Service discovery
• DNS or registry & hypermedia
• Load balancing
• Dedicated infrastructure
• So!ware load-balancer (Ribbon)
6
?
Microservice
Microservice
Messaging
• Microservices send message
• Asynchronously
7
Microservice
Microservice
Load Balancing
• Can have any numbers of
instances of a receiver
• Load Balancing very easy
8
Microservice
MicroserviceMicroserviceMicroservice
Service Discovery
• Microservices send
messages to queues / topics
• Receiver(s) read messages
• Decoupled by queues &
messages
• No need for service
discovery
9
Microservice
MicroserviceMicroserviceMicroservice
Fire & Forget
10
Example
11
Order
Payment
Credit card booking
200€
REST
• F&F doesn’t fit naturally
• Which HTTP method to use?
• Requests to create side
effects
• DELETE, PUT, POST
12
?
Microservice
Microservice
Safety / Idempotency
13
HTTP Method Safe Itempotent
GET
PUT
DELETE
POST
PATCH
REST: Failure
• Remote system unavailable
• Can’t easily retry because
of non-itempotency
• Status codes to
communicating semantic
problems
14
?
Microservice
Microservice
Messaging
• Hand message over to
messaging system
• Messaging system

guarantees delivery
• Stores message
• Acknowledgement
• Might have duplicated messages
15
Microservice
Microservice
Messaging: Failures
• Message doesn’t make it into
the message broker
• e.g. Timeout / TCP problem
• Retry
• Rely on re-transmission of
incoming message
16
Microservice
Microservice
Request & Reply
17
Example
18
Order
Payment
Validate credit card # OK / not OK
REST
• Natural model
• GET request
• Support for caching built in
• ETags, Last-Modified,
conditional GET / PUT
• Still needs care
• Timeouts, resilience
19
?
Microservice
Microservice
Messaging
• Send request
• Expect response
• Correlation
• …or temporary queue
• Asynchronous by design
20
Microservice
Microservice
Resilience
• Messaging can guarantee
delivery
• Failure just increases latency
• System must deal with
latency anyway
21
Microservice
Microservice
Events
22
Event Driven Architecture
• Order sends events
• Decoupled: no call but events
• Receiver handle events as
they please
23
Order
New Order
Event
Payment:
Books credit card
Delivery:

Ship products
Event Driven Architecture
• System are built around publishing domain events
• Multiple event listeners
• Event listener decides what to do
• Can easily add new event listener with additional business logic
• Challenges
• Delivery hard to guarantee
• What about old events?
24
Events + REST = Feed
• System stores domain events and publishes feed (e.g. Atom)
• Strong consistency within the service
• No additional infrastructure required
• Getting closer to Event Sourcing
• Clients subscribe to feed
• Clients in charge of polling frequency
• Server side optimizations: caching, ETags, pagination, links
• Client side optimizations: conditional requests
25
Messaging
• Publish / Subscribe e.g. JMS Topics
• History of events limited
• Guaranteed delivery somewhat harder
26
More Decoupling
• Enterprise Integration
Patterns (Hohpe, Woolf)
• www.eaipatterns.com
• Contains patterns like
Router, Translator or Adapter
• Create flexible messaging
architectures
27
Code
28
@Inject OrderRepository repository;
@Transactional
public void order(Order order) {
repository.save(order.deliver());
doCreditCardBooking(order.getCcNumber());
}
Transactions
29
Messaging & Transactions (Commit)
• Database commit
• Incoming messages
acknowledged
• Commit success: outgoing
messages sent
• Outgoing messages hopefully
handled successfully.
• Inconsistencies: Outgoing
messages not yet processed
30
Microservice
Microservice
Messaging & Transactions (Rollback)
• Database rollback
• Outgoing message not sent
• Incoming message
retransmitted
31
REST & Transactions
• No implicit infrastructure support
• But can be built manually
32
REST & Transactions
33
@Inject OrderRepository repository;
@Inject ApplicationEventPublisher publisher;
@Transactional
public void order(Order order) {
repository.save(order.deliver());
publisher.publish(new OrderDeliveredEvent(order));
}
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
public void onOrder(Order order) {
doCreditCardBooking(order.getCcNumber());
}
Evolvability
34
Evolvability
• Core aspect of Microservices: independent deployability
• Means: decoupling
• Change in one system must not break downstream systems
35
REST
• Core concepts built into the protocol
• Representations
• Content negotiation
• Media types
• Hypermedia
• Discoverability
36
Messaging
• Data format: Your choice
• i.e. easy to evolve if changes backwards-compatible
• But: no support for content negotation
37
Summary
38
REST Messaging
Communication style synchronous asynchronous
Service Discovery
DNS, Service Registry

Resource Discovery
Message Broker

Queues / Topics
Strengths
Content negotiation, Hypermedia
More control over direct interaction
Messages in
Re-submission of messages
Your next project:
Messaging or
REST?
39
You’ll probably
use both :-)
40

More Related Content

What's hot (20)

PDF
Kubernetes Networking
CJ Cullen
 
PDF
Bizweb Microservices Architecture
Khôi Nguyễn Minh
 
ODP
Introduction to Nginx
Knoldus Inc.
 
PPTX
Micro services Architecture
Araf Karsh Hamid
 
PPTX
kafka
Amikam Snir
 
PDF
Fundamentals of Apache Kafka
Chhavi Parasher
 
PPTX
Introduction to Apache Kafka
Jeff Holoman
 
PDF
Grafana introduction
Rico Chen
 
PPSX
Apache Flink, AWS Kinesis, Analytics
Araf Karsh Hamid
 
PPSX
Event Sourcing & CQRS, Kafka, Rabbit MQ
Araf Karsh Hamid
 
PPTX
Kafka at Peak Performance
Todd Palino
 
PPTX
OpenStack High Availability
Jakub Pavlik
 
KEY
Big Data in Real-Time at Twitter
nkallen
 
PPTX
Introduction to kubernetes
Rishabh Indoria
 
PPTX
Apache Kafka Best Practices
DataWorks Summit/Hadoop Summit
 
PDF
Autoscaling Kubernetes
craigbox
 
PPTX
Kubernetes Introduction
Martin Danielsson
 
PDF
The Future of Service Mesh
All Things Open
 
PDF
Cassandra serving netflix @ scale
Vinay Kumar Chella
 
PDF
[오픈소스컨설팅]Tomcat6&7 How To
Ji-Woong Choi
 
Kubernetes Networking
CJ Cullen
 
Bizweb Microservices Architecture
Khôi Nguyễn Minh
 
Introduction to Nginx
Knoldus Inc.
 
Micro services Architecture
Araf Karsh Hamid
 
Fundamentals of Apache Kafka
Chhavi Parasher
 
Introduction to Apache Kafka
Jeff Holoman
 
Grafana introduction
Rico Chen
 
Apache Flink, AWS Kinesis, Analytics
Araf Karsh Hamid
 
Event Sourcing & CQRS, Kafka, Rabbit MQ
Araf Karsh Hamid
 
Kafka at Peak Performance
Todd Palino
 
OpenStack High Availability
Jakub Pavlik
 
Big Data in Real-Time at Twitter
nkallen
 
Introduction to kubernetes
Rishabh Indoria
 
Apache Kafka Best Practices
DataWorks Summit/Hadoop Summit
 
Autoscaling Kubernetes
craigbox
 
Kubernetes Introduction
Martin Danielsson
 
The Future of Service Mesh
All Things Open
 
Cassandra serving netflix @ scale
Vinay Kumar Chella
 
[오픈소스컨설팅]Tomcat6&7 How To
Ji-Woong Choi
 

Viewers also liked (6)

PDF
Top Legacy Sins
Eberhard Wolff
 
PDF
Model with actors and implement with Akka
Ngoc Dao
 
PDF
Architectures and Alternatives
Eberhard Wolff
 
PPTX
Modern Distributed Messaging and RPC
Max Alexejev
 
PDF
Authentication: Cookies vs JWTs and why you’re doing it wrong
Derek Perkins
 
PDF
Лучшие практики Continuous Delivery с Docker / Дмитрий Столяров (Флант)
Ontico
 
Top Legacy Sins
Eberhard Wolff
 
Model with actors and implement with Akka
Ngoc Dao
 
Architectures and Alternatives
Eberhard Wolff
 
Modern Distributed Messaging and RPC
Max Alexejev
 
Authentication: Cookies vs JWTs and why you’re doing it wrong
Derek Perkins
 
Лучшие практики Continuous Delivery с Docker / Дмитрий Столяров (Флант)
Ontico
 
Ad

Similar to REST vs. Messaging For Microservices (20)

PDF
[WSO2Con EU 2017] Building Next Generation Banking Middleware at ING: The Rol...
WSO2
 
PPTX
Enterprise Application Architectures by Dr. Indika Kumara
Thejan Wijesinghe
 
PDF
Inter process communication
Tamer Rezk
 
PPT
Enterprise_Integration.ppt
ssuserf84b60
 
PPT
Soa implementation styles
Shivnarayan Varma
 
PDF
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2
 
KEY
S2GX 2012 - Introduction to Spring Integration and Spring Batch
Gunnar Hillert
 
PPTX
Enterprise application integration
Swarnesh Paul
 
DOCX
RabbitMQ in Microservice Architecture.docx
Shakuro
 
PPTX
cloud enabling tecnologies , unit ii [cc]
SMENAKA1
 
PDF
3298 microservices and how they relate to esb api and messaging - inter con...
Kim Clark
 
PDF
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
JSFestUA
 
PDF
Microservices Architecture
Srinivasan Nanduri
 
PPTX
Integration Patterns With Spring integration
Eldad Dor
 
PPTX
Modern Enterprise integration Strategies
Jesus Rodriguez
 
PDF
API Days Singapore
confluent
 
PDF
apidays LIVE Singapore - Moving to an Event Driven Microservices Architecture...
apidays
 
PDF
09-01-services-slides.pdf for educations
katariraju71
 
PPTX
Introduction to Microservices
MahmoudZidan41
 
PDF
SAI - Serverless Integration Architectures - 09/2019
Samuel Vandecasteele
 
[WSO2Con EU 2017] Building Next Generation Banking Middleware at ING: The Rol...
WSO2
 
Enterprise Application Architectures by Dr. Indika Kumara
Thejan Wijesinghe
 
Inter process communication
Tamer Rezk
 
Enterprise_Integration.ppt
ssuserf84b60
 
Soa implementation styles
Shivnarayan Varma
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2
 
S2GX 2012 - Introduction to Spring Integration and Spring Batch
Gunnar Hillert
 
Enterprise application integration
Swarnesh Paul
 
RabbitMQ in Microservice Architecture.docx
Shakuro
 
cloud enabling tecnologies , unit ii [cc]
SMENAKA1
 
3298 microservices and how they relate to esb api and messaging - inter con...
Kim Clark
 
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
JSFestUA
 
Microservices Architecture
Srinivasan Nanduri
 
Integration Patterns With Spring integration
Eldad Dor
 
Modern Enterprise integration Strategies
Jesus Rodriguez
 
API Days Singapore
confluent
 
apidays LIVE Singapore - Moving to an Event Driven Microservices Architecture...
apidays
 
09-01-services-slides.pdf for educations
katariraju71
 
Introduction to Microservices
MahmoudZidan41
 
SAI - Serverless Integration Architectures - 09/2019
Samuel Vandecasteele
 
Ad

More from Eberhard Wolff (20)

PDF
Beyond Microservices
Eberhard Wolff
 
PDF
The Frontiers of Continuous Delivery
Eberhard Wolff
 
PDF
Four Times Microservices - REST, Kubernetes, UI Integration, Async
Eberhard Wolff
 
PDF
Microservices - not just with Java
Eberhard Wolff
 
PDF
Deployment - Done Right!
Eberhard Wolff
 
PDF
Data Architecture not Just for Microservices
Eberhard Wolff
 
PDF
How to Split Your System into Microservices
Eberhard Wolff
 
PDF
Microservices and Self-contained System to Scale Agile
Eberhard Wolff
 
PDF
How Small Can Java Microservices Be?
Eberhard Wolff
 
PDF
Data Architecturen Not Just for Microservices
Eberhard Wolff
 
PDF
Microservices: Redundancy=Maintainability
Eberhard Wolff
 
PDF
Self-contained Systems: A Different Approach to Microservices
Eberhard Wolff
 
PDF
Microservices Technology Stack
Eberhard Wolff
 
PDF
Software Architecture for Innovation
Eberhard Wolff
 
PDF
Five (easy?) Steps Towards Continuous Delivery
Eberhard Wolff
 
PDF
Nanoservices and Microservices with Java
Eberhard Wolff
 
PDF
Microservices: Architecture to Support Agile
Eberhard Wolff
 
PDF
Microservices: Architecture to scale Agile
Eberhard Wolff
 
PDF
Microservices, DevOps, Continuous Delivery – More Than Three Buzzwords
Eberhard Wolff
 
PDF
Infrastructure for Continuous Delivery & Microservices: PaaS or Docker?
Eberhard Wolff
 
Beyond Microservices
Eberhard Wolff
 
The Frontiers of Continuous Delivery
Eberhard Wolff
 
Four Times Microservices - REST, Kubernetes, UI Integration, Async
Eberhard Wolff
 
Microservices - not just with Java
Eberhard Wolff
 
Deployment - Done Right!
Eberhard Wolff
 
Data Architecture not Just for Microservices
Eberhard Wolff
 
How to Split Your System into Microservices
Eberhard Wolff
 
Microservices and Self-contained System to Scale Agile
Eberhard Wolff
 
How Small Can Java Microservices Be?
Eberhard Wolff
 
Data Architecturen Not Just for Microservices
Eberhard Wolff
 
Microservices: Redundancy=Maintainability
Eberhard Wolff
 
Self-contained Systems: A Different Approach to Microservices
Eberhard Wolff
 
Microservices Technology Stack
Eberhard Wolff
 
Software Architecture for Innovation
Eberhard Wolff
 
Five (easy?) Steps Towards Continuous Delivery
Eberhard Wolff
 
Nanoservices and Microservices with Java
Eberhard Wolff
 
Microservices: Architecture to Support Agile
Eberhard Wolff
 
Microservices: Architecture to scale Agile
Eberhard Wolff
 
Microservices, DevOps, Continuous Delivery – More Than Three Buzzwords
Eberhard Wolff
 
Infrastructure for Continuous Delivery & Microservices: PaaS or Docker?
Eberhard Wolff
 

Recently uploaded (20)

PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
PPTX
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PPTX
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PDF
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
PDF
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PDF
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PDF
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PPTX
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 

REST vs. Messaging For Microservices