SlideShare une entreprise Scribd logo
1  sur  34
NServiceBus 
introduction to a message based 
distributed architecture
Mauro Servienti 
CTO @ Mastreeno, LTD 
mauro.servienti@mastreeno.com 
@mauroservienti 
//milestone.topics.it 
//github.com/mauroservienti 
NServiceBus trainer/support 
RavenDB trainer 
Microsoft MVP – Visual C#
Resources 
• Slides on SlideShare: 
//slideshare.net/mauroservienti 
• Samples on GitHub: 
//github.com/mauroservienti 
– Repository: Conferences 
– Branch: 2014/DDDEastAnglia
SO…YOU’D LIKE TO SCALE…
Scale out and HA 
• Basically means: horizontal scale & distribute; 
• It can also mean: 
– Async; 
– Non coupled: 
• we need to escape from the monolith; 
– Non temporally coupled: 
• Where makes sense we should not rely on two portion 
of the system to be live at the same time to work as 
expected
Distribution & RPC #1 
Given that we have occasionally connected 
moving parts: 
Web Frontend 
Shipping 
WCF Service 
Standard RPC call to WCF 
If the «Shipping» service fails, because of an hardware failure: 
• We can lose information; 
• We need to handle failures and retries manually;
Distribution & RPC #2 
Given that we have network with medium to high latency: 
Web Frontend 
If the connection with the «Shipping» service fails, is slow or timeouts: 
• We can lose information; 
• We slow down the whole system; 
Shipping 
WCF Service 
Standard RPC call to WCF
Messages 
A message can be shipped to a remote service 
via a queue 
competing consumers 
Web Frontend #1 Shipping Endpoint #1 
queue 
Web Frontend #2 Shipping Endpoint #2 
• If one endpoint fails messages will be picked by the other(s); 
• On slow connections or slow endpoints the entire system is not slowed;
issues and hiccups 
• “Distributed”: 
– We cannot rely on subsequent calls; 
– We cannot rely on ordering to drive the system; 
– We cannot rely on transactions; 
• “Async”: 
– Async errors; 
– Auditing; 
– Retries; 
– Timeouts;
Please welcome: 
NServiceBus
NServiceBus? 
• A toolkit: 
– reduce the friction of async and distributed 
development based on messages on top of 
queues; 
– Transport independent; 
– And much more, much :-) 
• A Platform: 
– A set of tools to designs, administer and monitor 
production solutions;
Concepts 
• Message 
– An atomic piece of information that has a semantic 
meaning in the business; 
• Component 
– Something that can handle a message; 
• Service 
– A set of components grouped by context; 
• Endpoint 
– A set of services grouped by: 
• SLA(s); 
• Infrastructure concerns; 
• Etc..;
DEMO
Recap 
• Request/reply pattern; 
• “Easy peasy” setup with the "Host"; 
• “Unubotrusive” mode: 
– reduce versioning problems across endpoints; 
• Receiver doesn’t know anything of the sender: 
– no coupling in the configuration; 
• The sender is configured to send messages 
– Based on mappings in the configuration;
Concepts #2 
• Command: A message that semantically 
identifies something to be done (imperative): 
– "CreateNewUser"; 
• Event: A message that semantically identifies 
something happened and immutable (past): 
– "NewUserCreated"; 
• Subscription: The notion that an endpoint is 
interested in an event;
DEMO
Recap 
• Event based pattern; 
• Events are “copied” per subscriber; 
• Subscriptions defined in the mappings config: 
• Subscriptions stored in RavenDB, by default: 
– Other options supported out-of-the-box 
• Events are, can be, .net interfaces: 
– Evolution and versioning is easier: interfaces can 
be composed;
TRANSPORT
Transports? 
• The “wire” that connects endpoints; 
• Supported transports (OOTB): 
• MSMQ; 
• RabbitMQ; 
• Sql Server; 
• Azure ServiceBus & Table Queues; 
• Transport independent; 
• In v4.x both parties must agree on the serialization format;
under the hood 
• At the Sender (or publisher): 
– Message serialization; 
– Push on the transport; 
• At the receiver 
– Message deserialization; 
– Component (Handler) lookup & invoke; 
• Wrapped in a “transaction”: 
– v4 requires the DTC, v5 won’t :-); 
• I hate the DTC :-P
Shit happens… 
HANDLING FAILURES
Async failures 
• First Level Retries: 
– Message handling is wrapped in a transaction; 
– By default is retried in sequence for 5 times; 
• Second Level Retries: 
– If FLR fails all the attempts, SLR kicks in; 
– 5s delay -> FLR, 10s delay -> FLR, 15s delay -> FLR; 
• Do not rely on hope: there is the error queue;
What are retries for and not for? 
• Transient failures: 
– E.g. Mail server down or third party services not 
available; 
• Bugs: 
– We deployed a bug, I did :-), and we do not lose 
anything 
• Not there to handle business exceptions: 
– they can, obviously, but their main target are the 
DevOps guys;
DEMO
Recap 
• “Easy peasy”; 
• Do not wrap your code in a try/catch block; 
• Keep your handlers small and idempotent: 
– They can be retried; 
– The more complex they are the harder will be to 
be idempotent; 
• The Particular Platform: 
– Tool chain to handle failures;
Didn’t we start speaking about scalability? 
SCALE-OUT
DEMO
Recap 
• Messages are an atomic piece of information: 
– They can be handled by one of the endpoints; 
• Multiple endpoints means: 
– More power to the business; 
– Much easier to be highly available; 
– Upgrade without shutting down the “system”; 
• If we have a storage: 
– We need to scale it out too; 
– Will it be complex? Can be, but we can;
Long running processes 
SAGA
Long and complex 
Check-out 
Order Items 
Pick up 
Ensure Items 
In Stock 
Bill customer 
credit card 
3rd party 
billing 
service 
Setup Order 
cancellation 
Timeout 
Start item 
collection 
Order ready 
to be 
shipped 
Customer 
credit card 
billed 
cancellation 
Timeout 
Elapsed 
Order 
Cancelled? yes 
No 
Cancel & 
Complete 
The order 
Ship & 
Complete 
The order 
User Request
DEMO
Recap 
• A long running process with a state; 
• Can be scaled-out; 
• Are concurrency safe; 
• Stored by default on RavenDB: 
– Other options supported out-of-the-box; 
• Timeouts are the way to go to handle the 
decision process based on a missing “answer”;
Mind… 
• Keep you handling code as small as possible; 
• If an handler does more than one single action 
it is a smell: 
– Exactly like a too long method; 
– Move to a Saga if you need a “shared” state; 
• The more an handler is simple the more it will 
be easy to make it idempotent;
Q&A 
THANK YOU, WE ARE ALL SET :-)

Contenu connexe

Tendances

Real time-system
Real time-systemReal time-system
Real time-systemysush
 
Microservice vs. Monolithic Architecture
Microservice vs. Monolithic ArchitectureMicroservice vs. Monolithic Architecture
Microservice vs. Monolithic ArchitecturePaul Mooney
 
Continuous Integration Testing for SAP
Continuous Integration Testing for SAPContinuous Integration Testing for SAP
Continuous Integration Testing for SAPWorksoft
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed Systemsvampugani
 
Microservices Tracing With Spring Cloud and Zipkin @CybercomDEV
Microservices Tracing With Spring Cloud and Zipkin @CybercomDEVMicroservices Tracing With Spring Cloud and Zipkin @CybercomDEV
Microservices Tracing With Spring Cloud and Zipkin @CybercomDEVMarcin Grzejszczak
 
Network File System
Network File SystemNetwork File System
Network File SystemDivyang Oza
 
Error Handling in Mulesoft
Error Handling in MulesoftError Handling in Mulesoft
Error Handling in MulesoftAmit Singh
 
Distributed Tracing in Practice
Distributed Tracing in PracticeDistributed Tracing in Practice
Distributed Tracing in PracticeDevOps.com
 
The RabbitMQ Message Broker
The RabbitMQ Message BrokerThe RabbitMQ Message Broker
The RabbitMQ Message BrokerMartin Toshev
 
Microservices architecture
Microservices architectureMicroservices architecture
Microservices architectureAbdelghani Azri
 
Introduction to Enterprise Service Bus
Introduction to Enterprise Service BusIntroduction to Enterprise Service Bus
Introduction to Enterprise Service BusMahmoud Ezzat
 
Transactions (Distributed computing)
Transactions (Distributed computing)Transactions (Distributed computing)
Transactions (Distributed computing)Sri Prasanna
 
Where is my MQ message on z/OS?
Where is my MQ message on z/OS?Where is my MQ message on z/OS?
Where is my MQ message on z/OS?Matt Leming
 
Troubleshooting and Best Practices with WSO2 Enterprise Integrator
Troubleshooting and Best Practices with WSO2 Enterprise IntegratorTroubleshooting and Best Practices with WSO2 Enterprise Integrator
Troubleshooting and Best Practices with WSO2 Enterprise IntegratorWSO2
 
Toronto Virtual Meetup #7 - Anypoint VPC, VPN and DLB Architecture
Toronto Virtual Meetup #7 - Anypoint VPC, VPN and DLB ArchitectureToronto Virtual Meetup #7 - Anypoint VPC, VPN and DLB Architecture
Toronto Virtual Meetup #7 - Anypoint VPC, VPN and DLB ArchitectureAlexandra N. Martinez
 
RabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example ApplicationsRabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example ApplicationsHoucheng Lin
 
Introduction to UNIX Command-Lines with examples
Introduction to UNIX Command-Lines with examplesIntroduction to UNIX Command-Lines with examples
Introduction to UNIX Command-Lines with examplesNoé Fernández-Pozo
 

Tendances (20)

Real time-system
Real time-systemReal time-system
Real time-system
 
Microservice vs. Monolithic Architecture
Microservice vs. Monolithic ArchitectureMicroservice vs. Monolithic Architecture
Microservice vs. Monolithic Architecture
 
Continuous Integration Testing for SAP
Continuous Integration Testing for SAPContinuous Integration Testing for SAP
Continuous Integration Testing for SAP
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed Systems
 
Microservices Tracing With Spring Cloud and Zipkin @CybercomDEV
Microservices Tracing With Spring Cloud and Zipkin @CybercomDEVMicroservices Tracing With Spring Cloud and Zipkin @CybercomDEV
Microservices Tracing With Spring Cloud and Zipkin @CybercomDEV
 
Network File System
Network File SystemNetwork File System
Network File System
 
Error Handling in Mulesoft
Error Handling in MulesoftError Handling in Mulesoft
Error Handling in Mulesoft
 
Distributed Tracing in Practice
Distributed Tracing in PracticeDistributed Tracing in Practice
Distributed Tracing in Practice
 
The RabbitMQ Message Broker
The RabbitMQ Message BrokerThe RabbitMQ Message Broker
The RabbitMQ Message Broker
 
Microservices architecture
Microservices architectureMicroservices architecture
Microservices architecture
 
Introduction to Enterprise Service Bus
Introduction to Enterprise Service BusIntroduction to Enterprise Service Bus
Introduction to Enterprise Service Bus
 
Transactions (Distributed computing)
Transactions (Distributed computing)Transactions (Distributed computing)
Transactions (Distributed computing)
 
Where is my MQ message on z/OS?
Where is my MQ message on z/OS?Where is my MQ message on z/OS?
Where is my MQ message on z/OS?
 
08. networking
08. networking08. networking
08. networking
 
Troubleshooting and Best Practices with WSO2 Enterprise Integrator
Troubleshooting and Best Practices with WSO2 Enterprise IntegratorTroubleshooting and Best Practices with WSO2 Enterprise Integrator
Troubleshooting and Best Practices with WSO2 Enterprise Integrator
 
Toronto Virtual Meetup #7 - Anypoint VPC, VPN and DLB Architecture
Toronto Virtual Meetup #7 - Anypoint VPC, VPN and DLB ArchitectureToronto Virtual Meetup #7 - Anypoint VPC, VPN and DLB Architecture
Toronto Virtual Meetup #7 - Anypoint VPC, VPN and DLB Architecture
 
Message passing in Distributed Computing Systems
Message passing in Distributed Computing SystemsMessage passing in Distributed Computing Systems
Message passing in Distributed Computing Systems
 
RabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example ApplicationsRabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example Applications
 
Introduction to UNIX Command-Lines with examples
Introduction to UNIX Command-Lines with examplesIntroduction to UNIX Command-Lines with examples
Introduction to UNIX Command-Lines with examples
 
Ipc in linux
Ipc in linuxIpc in linux
Ipc in linux
 

Similaire à NServiceBus - introduction to a message based distributed architecture

designing distributed scalable and reliable systems
designing distributed scalable and reliable systemsdesigning distributed scalable and reliable systems
designing distributed scalable and reliable systemsMauro Servienti
 
Cloud Messaging with NServiceBus and Microsoft Azure
Cloud Messaging with NServiceBus and Microsoft AzureCloud Messaging with NServiceBus and Microsoft Azure
Cloud Messaging with NServiceBus and Microsoft AzureParticular Software
 
Kubernetes Clusters At Scale: Managing Hundreds Apache Pinot Kubernetes Clust...
Kubernetes Clusters At Scale: Managing Hundreds Apache Pinot Kubernetes Clust...Kubernetes Clusters At Scale: Managing Hundreds Apache Pinot Kubernetes Clust...
Kubernetes Clusters At Scale: Managing Hundreds Apache Pinot Kubernetes Clust...Xiaoman DONG
 
Designing distributed, scalable and reliable systems using NServiceBus
Designing distributed, scalable and reliable systems using NServiceBusDesigning distributed, scalable and reliable systems using NServiceBus
Designing distributed, scalable and reliable systems using NServiceBusMauro Servienti
 
Rigadevdays - Communication in a microservice architecture
Rigadevdays  - Communication in a microservice architectureRigadevdays  - Communication in a microservice architecture
Rigadevdays - Communication in a microservice architectureIrina Scurtu
 
Cloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a CacheCloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a Cachecornelia davis
 
Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)Rick Hightower
 
Technical Webinar: Patterns for Integrating Your Salesforce App with Off-Plat...
Technical Webinar: Patterns for Integrating Your Salesforce App with Off-Plat...Technical Webinar: Patterns for Integrating Your Salesforce App with Off-Plat...
Technical Webinar: Patterns for Integrating Your Salesforce App with Off-Plat...CodeScience
 
SSL Checklist for Pentesters (BSides MCR 2014)
SSL Checklist for Pentesters (BSides MCR 2014)SSL Checklist for Pentesters (BSides MCR 2014)
SSL Checklist for Pentesters (BSides MCR 2014)Jerome Smith
 
Bol.com Tech lab September 2017 - Microservices in action at the Dutch Nation...
Bol.com Tech lab September 2017 - Microservices in action at the Dutch Nation...Bol.com Tech lab September 2017 - Microservices in action at the Dutch Nation...
Bol.com Tech lab September 2017 - Microservices in action at the Dutch Nation...Bert Jan Schrijver
 
The Good, The Bad, and The Avro (Graham Stirling, Saxo Bank and David Navalho...
The Good, The Bad, and The Avro (Graham Stirling, Saxo Bank and David Navalho...The Good, The Bad, and The Avro (Graham Stirling, Saxo Bank and David Navalho...
The Good, The Bad, and The Avro (Graham Stirling, Saxo Bank and David Navalho...confluent
 
Cloud Foundry Summit 2015: 12 Factor Apps For Operations
Cloud Foundry Summit 2015: 12 Factor Apps For OperationsCloud Foundry Summit 2015: 12 Factor Apps For Operations
Cloud Foundry Summit 2015: 12 Factor Apps For OperationsVMware Tanzu
 
Debugging Microservices - key challenges and techniques - Microservices Odesa...
Debugging Microservices - key challenges and techniques - Microservices Odesa...Debugging Microservices - key challenges and techniques - Microservices Odesa...
Debugging Microservices - key challenges and techniques - Microservices Odesa...Lohika_Odessa_TechTalks
 
Tech talk microservices debugging
Tech talk microservices debuggingTech talk microservices debugging
Tech talk microservices debuggingAndrey Kolodnitsky
 
UEMB210: Software Delivery: Best Practices
UEMB210: Software Delivery: Best PracticesUEMB210: Software Delivery: Best Practices
UEMB210: Software Delivery: Best PracticesIvanti
 
Performance Optimization of Cloud Based Applications by Peter Smith, ACL
Performance Optimization of Cloud Based Applications by Peter Smith, ACLPerformance Optimization of Cloud Based Applications by Peter Smith, ACL
Performance Optimization of Cloud Based Applications by Peter Smith, ACLTriNimbus
 
Devit - forget about http requests
Devit  -  forget about http requestsDevit  -  forget about http requests
Devit - forget about http requestsIrina Scurtu
 

Similaire à NServiceBus - introduction to a message based distributed architecture (20)

designing distributed scalable and reliable systems
designing distributed scalable and reliable systemsdesigning distributed scalable and reliable systems
designing distributed scalable and reliable systems
 
Cloud Messaging with NServiceBus and Microsoft Azure
Cloud Messaging with NServiceBus and Microsoft AzureCloud Messaging with NServiceBus and Microsoft Azure
Cloud Messaging with NServiceBus and Microsoft Azure
 
Kubernetes Clusters At Scale: Managing Hundreds Apache Pinot Kubernetes Clust...
Kubernetes Clusters At Scale: Managing Hundreds Apache Pinot Kubernetes Clust...Kubernetes Clusters At Scale: Managing Hundreds Apache Pinot Kubernetes Clust...
Kubernetes Clusters At Scale: Managing Hundreds Apache Pinot Kubernetes Clust...
 
Designing distributed, scalable and reliable systems using NServiceBus
Designing distributed, scalable and reliable systems using NServiceBusDesigning distributed, scalable and reliable systems using NServiceBus
Designing distributed, scalable and reliable systems using NServiceBus
 
Rigadevdays - Communication in a microservice architecture
Rigadevdays  - Communication in a microservice architectureRigadevdays  - Communication in a microservice architecture
Rigadevdays - Communication in a microservice architecture
 
Redundant devops
Redundant devopsRedundant devops
Redundant devops
 
Cloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a CacheCloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a Cache
 
Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)
 
Windows Azure Essentials V3
Windows Azure Essentials V3Windows Azure Essentials V3
Windows Azure Essentials V3
 
Technical Webinar: Patterns for Integrating Your Salesforce App with Off-Plat...
Technical Webinar: Patterns for Integrating Your Salesforce App with Off-Plat...Technical Webinar: Patterns for Integrating Your Salesforce App with Off-Plat...
Technical Webinar: Patterns for Integrating Your Salesforce App with Off-Plat...
 
SSL Checklist for Pentesters (BSides MCR 2014)
SSL Checklist for Pentesters (BSides MCR 2014)SSL Checklist for Pentesters (BSides MCR 2014)
SSL Checklist for Pentesters (BSides MCR 2014)
 
Bol.com Tech lab September 2017 - Microservices in action at the Dutch Nation...
Bol.com Tech lab September 2017 - Microservices in action at the Dutch Nation...Bol.com Tech lab September 2017 - Microservices in action at the Dutch Nation...
Bol.com Tech lab September 2017 - Microservices in action at the Dutch Nation...
 
The Good, The Bad, and The Avro (Graham Stirling, Saxo Bank and David Navalho...
The Good, The Bad, and The Avro (Graham Stirling, Saxo Bank and David Navalho...The Good, The Bad, and The Avro (Graham Stirling, Saxo Bank and David Navalho...
The Good, The Bad, and The Avro (Graham Stirling, Saxo Bank and David Navalho...
 
Cloud Foundry Summit 2015: 12 Factor Apps For Operations
Cloud Foundry Summit 2015: 12 Factor Apps For OperationsCloud Foundry Summit 2015: 12 Factor Apps For Operations
Cloud Foundry Summit 2015: 12 Factor Apps For Operations
 
Voldemort Nosql
Voldemort NosqlVoldemort Nosql
Voldemort Nosql
 
Debugging Microservices - key challenges and techniques - Microservices Odesa...
Debugging Microservices - key challenges and techniques - Microservices Odesa...Debugging Microservices - key challenges and techniques - Microservices Odesa...
Debugging Microservices - key challenges and techniques - Microservices Odesa...
 
Tech talk microservices debugging
Tech talk microservices debuggingTech talk microservices debugging
Tech talk microservices debugging
 
UEMB210: Software Delivery: Best Practices
UEMB210: Software Delivery: Best PracticesUEMB210: Software Delivery: Best Practices
UEMB210: Software Delivery: Best Practices
 
Performance Optimization of Cloud Based Applications by Peter Smith, ACL
Performance Optimization of Cloud Based Applications by Peter Smith, ACLPerformance Optimization of Cloud Based Applications by Peter Smith, ACL
Performance Optimization of Cloud Based Applications by Peter Smith, ACL
 
Devit - forget about http requests
Devit  -  forget about http requestsDevit  -  forget about http requests
Devit - forget about http requests
 

Plus de Mauro Servienti

Welcome to the (state) machine @ ExploreDDD 2019
Welcome to the (state) machine @ ExploreDDD 2019Welcome to the (state) machine @ ExploreDDD 2019
Welcome to the (state) machine @ ExploreDDD 2019Mauro Servienti
 
Designing a ui for microservices @ .NET Day Switzerland 2019
Designing a ui for microservices @ .NET Day Switzerland 2019Designing a ui for microservices @ .NET Day Switzerland 2019
Designing a ui for microservices @ .NET Day Switzerland 2019Mauro Servienti
 
Welcome to the (state) machine @ Xe One Day Enterprise Applications
Welcome to the (state) machine @ Xe One Day Enterprise ApplicationsWelcome to the (state) machine @ Xe One Day Enterprise Applications
Welcome to the (state) machine @ Xe One Day Enterprise ApplicationsMauro Servienti
 
All our aggregates are wrong @ NDC Copenhagen 2019
All our aggregates are wrong @ NDC Copenhagen 2019All our aggregates are wrong @ NDC Copenhagen 2019
All our aggregates are wrong @ NDC Copenhagen 2019Mauro Servienti
 
Be like water, my friend @ Agile for Innovation 2019
Be like water, my friend @ Agile for Innovation 2019Be like water, my friend @ Agile for Innovation 2019
Be like water, my friend @ Agile for Innovation 2019Mauro Servienti
 
Microservices architecture is it the right choice to design long-living syste...
Microservices architecture is it the right choice to design long-living syste...Microservices architecture is it the right choice to design long-living syste...
Microservices architecture is it the right choice to design long-living syste...Mauro Servienti
 
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019Mauro Servienti
 
Living organizations, particular software @ do IT Better Parma
Living organizations, particular software @ do IT Better ParmaLiving organizations, particular software @ do IT Better Parma
Living organizations, particular software @ do IT Better ParmaMauro Servienti
 
Welcome to the (state) machine @ Crafted Software
Welcome to the (state) machine @ Crafted SoftwareWelcome to the (state) machine @ Crafted Software
Welcome to the (state) machine @ Crafted SoftwareMauro Servienti
 
PO is dead, long live the PO - Italian Agile Day 2018
PO is dead, long live the PO - Italian Agile Day 2018PO is dead, long live the PO - Italian Agile Day 2018
PO is dead, long live the PO - Italian Agile Day 2018Mauro Servienti
 
Design a UI for your Microservices @ Do IT Better
Design a UI for your Microservices @ Do IT BetterDesign a UI for your Microservices @ Do IT Better
Design a UI for your Microservices @ Do IT BetterMauro Servienti
 
Microservices and pineapple on pizza what do they have in common - dos and ...
Microservices and pineapple on pizza   what do they have in common - dos and ...Microservices and pineapple on pizza   what do they have in common - dos and ...
Microservices and pineapple on pizza what do they have in common - dos and ...Mauro Servienti
 
All our aggregates are wrong (ExploreDDD 2018)
All our aggregates are wrong (ExploreDDD 2018)All our aggregates are wrong (ExploreDDD 2018)
All our aggregates are wrong (ExploreDDD 2018)Mauro Servienti
 
Designing a ui for microservices
Designing a ui for microservicesDesigning a ui for microservices
Designing a ui for microservicesMauro Servienti
 
Po is dead, long live the po
Po is dead, long live the poPo is dead, long live the po
Po is dead, long live the poMauro Servienti
 
Shipping code is not the problem, deciding what to ship it is!
Shipping code is not the problem, deciding what to ship it is!Shipping code is not the problem, deciding what to ship it is!
Shipping code is not the problem, deciding what to ship it is!Mauro Servienti
 
GraphQL - Where are you from? Where are you going?
GraphQL - Where are you from? Where are you going?GraphQL - Where are you from? Where are you going?
GraphQL - Where are you from? Where are you going?Mauro Servienti
 
Dall'idea al deploy un lungo viaggio che passa per git flow e semver
Dall'idea al deploy   un lungo viaggio che passa per git flow e semverDall'idea al deploy   un lungo viaggio che passa per git flow e semver
Dall'idea al deploy un lungo viaggio che passa per git flow e semverMauro Servienti
 
Progettare una UI per i Microservices
Progettare una UI per i MicroservicesProgettare una UI per i Microservices
Progettare una UI per i MicroservicesMauro Servienti
 
The road to a Service Oriented Architecture is paved with messages
The road to a Service Oriented Architecture is paved with messagesThe road to a Service Oriented Architecture is paved with messages
The road to a Service Oriented Architecture is paved with messagesMauro Servienti
 

Plus de Mauro Servienti (20)

Welcome to the (state) machine @ ExploreDDD 2019
Welcome to the (state) machine @ ExploreDDD 2019Welcome to the (state) machine @ ExploreDDD 2019
Welcome to the (state) machine @ ExploreDDD 2019
 
Designing a ui for microservices @ .NET Day Switzerland 2019
Designing a ui for microservices @ .NET Day Switzerland 2019Designing a ui for microservices @ .NET Day Switzerland 2019
Designing a ui for microservices @ .NET Day Switzerland 2019
 
Welcome to the (state) machine @ Xe One Day Enterprise Applications
Welcome to the (state) machine @ Xe One Day Enterprise ApplicationsWelcome to the (state) machine @ Xe One Day Enterprise Applications
Welcome to the (state) machine @ Xe One Day Enterprise Applications
 
All our aggregates are wrong @ NDC Copenhagen 2019
All our aggregates are wrong @ NDC Copenhagen 2019All our aggregates are wrong @ NDC Copenhagen 2019
All our aggregates are wrong @ NDC Copenhagen 2019
 
Be like water, my friend @ Agile for Innovation 2019
Be like water, my friend @ Agile for Innovation 2019Be like water, my friend @ Agile for Innovation 2019
Be like water, my friend @ Agile for Innovation 2019
 
Microservices architecture is it the right choice to design long-living syste...
Microservices architecture is it the right choice to design long-living syste...Microservices architecture is it the right choice to design long-living syste...
Microservices architecture is it the right choice to design long-living syste...
 
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
 
Living organizations, particular software @ do IT Better Parma
Living organizations, particular software @ do IT Better ParmaLiving organizations, particular software @ do IT Better Parma
Living organizations, particular software @ do IT Better Parma
 
Welcome to the (state) machine @ Crafted Software
Welcome to the (state) machine @ Crafted SoftwareWelcome to the (state) machine @ Crafted Software
Welcome to the (state) machine @ Crafted Software
 
PO is dead, long live the PO - Italian Agile Day 2018
PO is dead, long live the PO - Italian Agile Day 2018PO is dead, long live the PO - Italian Agile Day 2018
PO is dead, long live the PO - Italian Agile Day 2018
 
Design a UI for your Microservices @ Do IT Better
Design a UI for your Microservices @ Do IT BetterDesign a UI for your Microservices @ Do IT Better
Design a UI for your Microservices @ Do IT Better
 
Microservices and pineapple on pizza what do they have in common - dos and ...
Microservices and pineapple on pizza   what do they have in common - dos and ...Microservices and pineapple on pizza   what do they have in common - dos and ...
Microservices and pineapple on pizza what do they have in common - dos and ...
 
All our aggregates are wrong (ExploreDDD 2018)
All our aggregates are wrong (ExploreDDD 2018)All our aggregates are wrong (ExploreDDD 2018)
All our aggregates are wrong (ExploreDDD 2018)
 
Designing a ui for microservices
Designing a ui for microservicesDesigning a ui for microservices
Designing a ui for microservices
 
Po is dead, long live the po
Po is dead, long live the poPo is dead, long live the po
Po is dead, long live the po
 
Shipping code is not the problem, deciding what to ship it is!
Shipping code is not the problem, deciding what to ship it is!Shipping code is not the problem, deciding what to ship it is!
Shipping code is not the problem, deciding what to ship it is!
 
GraphQL - Where are you from? Where are you going?
GraphQL - Where are you from? Where are you going?GraphQL - Where are you from? Where are you going?
GraphQL - Where are you from? Where are you going?
 
Dall'idea al deploy un lungo viaggio che passa per git flow e semver
Dall'idea al deploy   un lungo viaggio che passa per git flow e semverDall'idea al deploy   un lungo viaggio che passa per git flow e semver
Dall'idea al deploy un lungo viaggio che passa per git flow e semver
 
Progettare una UI per i Microservices
Progettare una UI per i MicroservicesProgettare una UI per i Microservices
Progettare una UI per i Microservices
 
The road to a Service Oriented Architecture is paved with messages
The road to a Service Oriented Architecture is paved with messagesThe road to a Service Oriented Architecture is paved with messages
The road to a Service Oriented Architecture is paved with messages
 

Dernier

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 

Dernier (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 

NServiceBus - introduction to a message based distributed architecture

  • 1. NServiceBus introduction to a message based distributed architecture
  • 2. Mauro Servienti CTO @ Mastreeno, LTD mauro.servienti@mastreeno.com @mauroservienti //milestone.topics.it //github.com/mauroservienti NServiceBus trainer/support RavenDB trainer Microsoft MVP – Visual C#
  • 3. Resources • Slides on SlideShare: //slideshare.net/mauroservienti • Samples on GitHub: //github.com/mauroservienti – Repository: Conferences – Branch: 2014/DDDEastAnglia
  • 5. Scale out and HA • Basically means: horizontal scale & distribute; • It can also mean: – Async; – Non coupled: • we need to escape from the monolith; – Non temporally coupled: • Where makes sense we should not rely on two portion of the system to be live at the same time to work as expected
  • 6. Distribution & RPC #1 Given that we have occasionally connected moving parts: Web Frontend Shipping WCF Service Standard RPC call to WCF If the «Shipping» service fails, because of an hardware failure: • We can lose information; • We need to handle failures and retries manually;
  • 7. Distribution & RPC #2 Given that we have network with medium to high latency: Web Frontend If the connection with the «Shipping» service fails, is slow or timeouts: • We can lose information; • We slow down the whole system; Shipping WCF Service Standard RPC call to WCF
  • 8. Messages A message can be shipped to a remote service via a queue competing consumers Web Frontend #1 Shipping Endpoint #1 queue Web Frontend #2 Shipping Endpoint #2 • If one endpoint fails messages will be picked by the other(s); • On slow connections or slow endpoints the entire system is not slowed;
  • 9. issues and hiccups • “Distributed”: – We cannot rely on subsequent calls; – We cannot rely on ordering to drive the system; – We cannot rely on transactions; • “Async”: – Async errors; – Auditing; – Retries; – Timeouts;
  • 11. NServiceBus? • A toolkit: – reduce the friction of async and distributed development based on messages on top of queues; – Transport independent; – And much more, much :-) • A Platform: – A set of tools to designs, administer and monitor production solutions;
  • 12. Concepts • Message – An atomic piece of information that has a semantic meaning in the business; • Component – Something that can handle a message; • Service – A set of components grouped by context; • Endpoint – A set of services grouped by: • SLA(s); • Infrastructure concerns; • Etc..;
  • 13. DEMO
  • 14. Recap • Request/reply pattern; • “Easy peasy” setup with the "Host"; • “Unubotrusive” mode: – reduce versioning problems across endpoints; • Receiver doesn’t know anything of the sender: – no coupling in the configuration; • The sender is configured to send messages – Based on mappings in the configuration;
  • 15. Concepts #2 • Command: A message that semantically identifies something to be done (imperative): – "CreateNewUser"; • Event: A message that semantically identifies something happened and immutable (past): – "NewUserCreated"; • Subscription: The notion that an endpoint is interested in an event;
  • 16. DEMO
  • 17. Recap • Event based pattern; • Events are “copied” per subscriber; • Subscriptions defined in the mappings config: • Subscriptions stored in RavenDB, by default: – Other options supported out-of-the-box • Events are, can be, .net interfaces: – Evolution and versioning is easier: interfaces can be composed;
  • 19. Transports? • The “wire” that connects endpoints; • Supported transports (OOTB): • MSMQ; • RabbitMQ; • Sql Server; • Azure ServiceBus & Table Queues; • Transport independent; • In v4.x both parties must agree on the serialization format;
  • 20. under the hood • At the Sender (or publisher): – Message serialization; – Push on the transport; • At the receiver – Message deserialization; – Component (Handler) lookup & invoke; • Wrapped in a “transaction”: – v4 requires the DTC, v5 won’t :-); • I hate the DTC :-P
  • 22. Async failures • First Level Retries: – Message handling is wrapped in a transaction; – By default is retried in sequence for 5 times; • Second Level Retries: – If FLR fails all the attempts, SLR kicks in; – 5s delay -> FLR, 10s delay -> FLR, 15s delay -> FLR; • Do not rely on hope: there is the error queue;
  • 23. What are retries for and not for? • Transient failures: – E.g. Mail server down or third party services not available; • Bugs: – We deployed a bug, I did :-), and we do not lose anything • Not there to handle business exceptions: – they can, obviously, but their main target are the DevOps guys;
  • 24. DEMO
  • 25. Recap • “Easy peasy”; • Do not wrap your code in a try/catch block; • Keep your handlers small and idempotent: – They can be retried; – The more complex they are the harder will be to be idempotent; • The Particular Platform: – Tool chain to handle failures;
  • 26. Didn’t we start speaking about scalability? SCALE-OUT
  • 27. DEMO
  • 28. Recap • Messages are an atomic piece of information: – They can be handled by one of the endpoints; • Multiple endpoints means: – More power to the business; – Much easier to be highly available; – Upgrade without shutting down the “system”; • If we have a storage: – We need to scale it out too; – Will it be complex? Can be, but we can;
  • 30. Long and complex Check-out Order Items Pick up Ensure Items In Stock Bill customer credit card 3rd party billing service Setup Order cancellation Timeout Start item collection Order ready to be shipped Customer credit card billed cancellation Timeout Elapsed Order Cancelled? yes No Cancel & Complete The order Ship & Complete The order User Request
  • 31. DEMO
  • 32. Recap • A long running process with a state; • Can be scaled-out; • Are concurrency safe; • Stored by default on RavenDB: – Other options supported out-of-the-box; • Timeouts are the way to go to handle the decision process based on a missing “answer”;
  • 33. Mind… • Keep you handling code as small as possible; • If an handler does more than one single action it is a smell: – Exactly like a too long method; – Move to a Saga if you need a “shared” state; • The more an handler is simple the more it will be easy to make it idempotent;
  • 34. Q&A THANK YOU, WE ARE ALL SET :-)