SlideShare a Scribd company logo
1 of 35
Download to read offline
~
~ 
Roy Cornelissen 
Software Architect 
@roycornelissen 
Mark Taling 
Lead Developer 
@marktaling
Where we started 
Discovering NServiceBus 
Multi tenancy 
Saga’s 
The evolution of NServiceBus 
Performance considerations 
Maintainability 
NServiceBusin a brownfield 
Wrap up 
Q&A
Integration Layer 
Service Layer 
NIS 
Presentation Layer 
Planning UI 
Reporting UI 
customer 
external apps 
Employee Self Service 
Common 
Forecast 
Realization 
Payment 
Schedule
Monitoring & Control 
Integration Layer 
Service Layer 
NIS 
Presentation Layer 
Planning UI 
Reporting UI 
Employee Self Service 
Common 
Forecast 
Payment 
Schedule 
Service Bus 
Integration Services 
IS HRM 
IS Payroll 
IS Budget 
IS Provisioning 
IS Time 
IS Point of Sale 
Realization
Tenant ID 
Tenant ID 
Tenant ID 
Tenant ID
publicclassBuildPrincipalFromHeaders:IMutateIncomingMessages 
{ 
publicobjectMutateIncoming(objectmessage) 
{ 
Thread.CurrentPrincipal=null; 
stringtenantId=Headers.GetMessageHeader(message,“urn:dv:tenantid”); 
ICollection<Claim>claims=newList<Claim>(); 
… 
claims.Add(newClaim(SecurityConstants.TenantIdClaim,tenantId)); 
varprincipal=newClaimsPrincipal( 
newClaimsIdentityCollection{ newClaimsIdentity(claims) }); 
Thread.CurrentPrincipal=principal; 
returnmessage; 
} 
…
publicclassSetHeadersFromPrincipal:IMutateOutgoingMessages 
{ 
publicIBusBus{get;set;} 
publicobjectMutateOutgoing(objectmessage) 
{ 
IClaimsIdentityidentity= 
Thread.CurrentPrincipal.IdentityasIClaimsIdentity; 
stringtenantId=identity.GetTenantId(); 
if(!string.IsNullOrWhiteSpace(tenantId)) 
{ 
Bus.SetMessageHeader(message,“urn:dv:tenantid”,tenantId); 
} 
returnmessage; 
} 
…
-Multiple properties 
-Concatenation 
-IFindSaga 
-ISagaPersister
publicclassAdvancedRavenSagaPersister: RavenSagaPersister, ISagaPersister{ publicAdvancedRavenSagaPersister(RavenSessionFactorysessionFactory): base(sessionFactory) { } publicnewvoidSave(IContainSagaDatasaga) { base.Save(saga); } publicnewvoidComplete(IContainSagaDatasaga) { base.Complete(saga); } voidISagaPersister.Save(IContainSagaDatasaga) { Save(saga); } voidISagaPersister.Complete(IContainSagaDatasaga) { Complete(saga); } }
publicclassAdvancedRavenSagaPersister: RavenSagaPersister, ISagaPersister{ publicAdvancedRavenSagaPersister(RavenSessionFactorysessionFactory): base(sessionFactory) { } publicnewvoidSave(IContainSagaDatasaga) { base.Save(saga); } publicnewvoidComplete(IContainSagaDatasaga) { base.Complete(saga); } voidISagaPersister.Save(IContainSagaDatasaga) { Save(saga); } voidISagaPersister.Complete(IContainSagaDatasaga) { Complete(saga); } }
publicclassAdvancedRavenSagaPersister: RavenSagaPersister, ISagaPersister{ publicAdvancedRavenSagaPersister(RavenSessionFactorysessionFactory): base(sessionFactory) { } publicnewvoidSave(IContainSagaDatasaga) { base.Save(saga); StoreMappingKeys(saga); } publicnewvoidComplete(IContainSagaDatasaga) { RemoveMappingKeys(saga); base.Complete(saga); } voidISagaPersister.Save(IContainSagaDatasaga) { Save(saga); } voidISagaPersister.Complete(IContainSagaDatasaga) { Complete(saga); } }
publicclassAdvancedRavenSagaPersister: RavenSagaPersister, ISagaPersister{ privatereadonlyRavenSessionFactory_sessionFactory; publicAdvancedRavenSagaPersister(RavenSessionFactorysessionFactory): base(sessionFactory) { _sessionFactory= sessionFactory; } publicnewvoidSave(IContainSagaDatasaga) { base.Save(saga); StoreMappingKeys(saga); } publicnewvoidComplete(IContainSagaDatasaga) { RemoveMappingKeys(saga); base.Complete(saga); } voidISagaPersister.Save(IContainSagaDatasaga) { Save(saga); } voidISagaPersister.Complete(IContainSagaDatasaga) { Complete(saga); } }
publicclassAdvancedRavenSagaPersister: RavenSagaPersister, ISagaPersister{ privatereadonlyRavenSessionFactory_sessionFactory; publicAdvancedRavenSagaPersister(RavenSessionFactorysessionFactory): base(sessionFactory) { _sessionFactory= sessionFactory; } publicnewvoidSave(IContainSagaDatasaga) { base.Save(saga); StoreMappingKeys(saga); } publicnewvoidComplete(IContainSagaDatasaga) { RemoveMappingKeys(saga); base.Complete(saga); } voidISagaPersister.Save(IContainSagaDatasaga) { Save(saga); } voidISagaPersister.Complete(IContainSagaDatasaga) { Complete(saga); } } vardocument = _sessionFactory.Session.Include("SagaDocId").Load<SagaMappingIdentity>(mappingId); return_sessionFactory.Session.Load<TSagaData>(document.SagaId);
RequestUtcTimeout<PolicyRenewal>(TimeSpan.FromDays(300));
Lessonslearned 
-Upgrade regularly 
-RetryPoCsandassumptions 
-Beware of abstractions
Lessonslearned 
-Upgrade regularly 
-RetryPoCsandassumptions 
-Beware of abstractions
Keep yourtransactions on a diet 
Design withparallelismin mind 
{Tx} 
[Unique] saga properties
Keep yourtransactions on a diet 
Design withparallelismin mind 
{Tx} 
{Tx} 
[Unique] saga properties 
{Tx}
UseTransport<Rfc1149>(); 
http://www.make-awesome.com/2014/04/nservicebus-transport-for-rfc-1149/
NServiceBusis an opinionatedframework 
If it fits, it fits like a glove 
Prepare to make concessionsat first 
Clean up later 
Messaging makes totally different use cases possible 
Requires a new mindsetfor everyone
NServiceBusis a greatway tobreak open existingarchitectures 
Despiteitsflexibility andpluggability, alwaysfollow itsdesign principles 
Go withthe flow, itsolvesreal life problemsyoumightnotknowyouhave
~ 
Roy Cornelissen 
Software Architect 
@roycornelissen 
Mark Taling 
Lead Developer 
@marktaling 
blogs.infosupport.com

More Related Content

What's hot

DDD Sydney 2011 - Getting out of Sync with IIS and Riding a Comet
DDD Sydney 2011 - Getting out of Sync with IIS and Riding a CometDDD Sydney 2011 - Getting out of Sync with IIS and Riding a Comet
DDD Sydney 2011 - Getting out of Sync with IIS and Riding a CometRichard Banks
 
Celix, Universal OSGi?
Celix, Universal OSGi?Celix, Universal OSGi?
Celix, Universal OSGi?abroekhuis
 
Message Oriented Architecture using NServiceBus
Message Oriented Architecture using NServiceBusMessage Oriented Architecture using NServiceBus
Message Oriented Architecture using NServiceBusLars-Erik Kindblad
 
Taking Your Enterprise to the Next Level with WSO2 Message Broker and WSO2 En...
Taking Your Enterprise to the Next Level with WSO2 Message Broker and WSO2 En...Taking Your Enterprise to the Next Level with WSO2 Message Broker and WSO2 En...
Taking Your Enterprise to the Next Level with WSO2 Message Broker and WSO2 En...WSO2
 
Messaging in the cloud - Azure Service Bus
Messaging in the cloud - Azure Service BusMessaging in the cloud - Azure Service Bus
Messaging in the cloud - Azure Service BusSean Feldman
 
CQRS and ES with Lagom
CQRS and ES with LagomCQRS and ES with Lagom
CQRS and ES with LagomMiel Donkers
 
Sql Server Service Broker In The Real World
Sql Server Service Broker In The Real WorldSql Server Service Broker In The Real World
Sql Server Service Broker In The Real WorldQuest Software
 
Automating the Entire PostgreSQL Lifecycle
Automating the Entire PostgreSQL Lifecycle Automating the Entire PostgreSQL Lifecycle
Automating the Entire PostgreSQL Lifecycle anynines GmbH
 
Building a Web Frontend with Microservices and NGINX Plus
Building a Web Frontend with Microservices and NGINX PlusBuilding a Web Frontend with Microservices and NGINX Plus
Building a Web Frontend with Microservices and NGINX PlusNGINX, Inc.
 
KubeCon + CloudNative Con NA 2021 | A New Generation of NATS
KubeCon + CloudNative Con NA 2021 | A New Generation of NATSKubeCon + CloudNative Con NA 2021 | A New Generation of NATS
KubeCon + CloudNative Con NA 2021 | A New Generation of NATSNATS
 
Azure paa s v2 – microservices, microsoft (azure) service fabric, .apps and o...
Azure paa s v2 – microservices, microsoft (azure) service fabric, .apps and o...Azure paa s v2 – microservices, microsoft (azure) service fabric, .apps and o...
Azure paa s v2 – microservices, microsoft (azure) service fabric, .apps and o...Tomasz Kopacz
 
How Clarifai uses NATS and Kubernetes for Machine Learning
How Clarifai uses NATS and Kubernetes for Machine LearningHow Clarifai uses NATS and Kubernetes for Machine Learning
How Clarifai uses NATS and Kubernetes for Machine LearningApcera
 
JavaOne 2016 - Reactive Microservices with Java and Java EE
JavaOne 2016 - Reactive Microservices with Java and Java EEJavaOne 2016 - Reactive Microservices with Java and Java EE
JavaOne 2016 - Reactive Microservices with Java and Java EERodrigo Cândido da Silva
 
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShiftReal-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShiftChristian Posta
 
How lagom helps to build real world microservice systems
How lagom helps to build real world microservice systemsHow lagom helps to build real world microservice systems
How lagom helps to build real world microservice systemsMarkus Eisele
 
Compensating Transactions: When ACID is too much
Compensating Transactions: When ACID is too muchCompensating Transactions: When ACID is too much
Compensating Transactions: When ACID is too muchJBUG London
 
Azure service fabric: a gentle introduction
Azure service fabric: a gentle introductionAzure service fabric: a gentle introduction
Azure service fabric: a gentle introductionAlessandro Melchiori
 

What's hot (20)

DDD Sydney 2011 - Getting out of Sync with IIS and Riding a Comet
DDD Sydney 2011 - Getting out of Sync with IIS and Riding a CometDDD Sydney 2011 - Getting out of Sync with IIS and Riding a Comet
DDD Sydney 2011 - Getting out of Sync with IIS and Riding a Comet
 
Reactive Architectures
Reactive ArchitecturesReactive Architectures
Reactive Architectures
 
Celix, Universal OSGi?
Celix, Universal OSGi?Celix, Universal OSGi?
Celix, Universal OSGi?
 
Message Oriented Architecture using NServiceBus
Message Oriented Architecture using NServiceBusMessage Oriented Architecture using NServiceBus
Message Oriented Architecture using NServiceBus
 
Taking Your Enterprise to the Next Level with WSO2 Message Broker and WSO2 En...
Taking Your Enterprise to the Next Level with WSO2 Message Broker and WSO2 En...Taking Your Enterprise to the Next Level with WSO2 Message Broker and WSO2 En...
Taking Your Enterprise to the Next Level with WSO2 Message Broker and WSO2 En...
 
Messaging in the cloud - Azure Service Bus
Messaging in the cloud - Azure Service BusMessaging in the cloud - Azure Service Bus
Messaging in the cloud - Azure Service Bus
 
CQRS and ES with Lagom
CQRS and ES with LagomCQRS and ES with Lagom
CQRS and ES with Lagom
 
Sql Server Service Broker In The Real World
Sql Server Service Broker In The Real WorldSql Server Service Broker In The Real World
Sql Server Service Broker In The Real World
 
Automating the Entire PostgreSQL Lifecycle
Automating the Entire PostgreSQL Lifecycle Automating the Entire PostgreSQL Lifecycle
Automating the Entire PostgreSQL Lifecycle
 
Micro service architecture
Micro service architectureMicro service architecture
Micro service architecture
 
Building a Web Frontend with Microservices and NGINX Plus
Building a Web Frontend with Microservices and NGINX PlusBuilding a Web Frontend with Microservices and NGINX Plus
Building a Web Frontend with Microservices and NGINX Plus
 
KubeCon + CloudNative Con NA 2021 | A New Generation of NATS
KubeCon + CloudNative Con NA 2021 | A New Generation of NATSKubeCon + CloudNative Con NA 2021 | A New Generation of NATS
KubeCon + CloudNative Con NA 2021 | A New Generation of NATS
 
Azure paa s v2 – microservices, microsoft (azure) service fabric, .apps and o...
Azure paa s v2 – microservices, microsoft (azure) service fabric, .apps and o...Azure paa s v2 – microservices, microsoft (azure) service fabric, .apps and o...
Azure paa s v2 – microservices, microsoft (azure) service fabric, .apps and o...
 
How Clarifai uses NATS and Kubernetes for Machine Learning
How Clarifai uses NATS and Kubernetes for Machine LearningHow Clarifai uses NATS and Kubernetes for Machine Learning
How Clarifai uses NATS and Kubernetes for Machine Learning
 
JavaOne 2016 - Reactive Microservices with Java and Java EE
JavaOne 2016 - Reactive Microservices with Java and Java EEJavaOne 2016 - Reactive Microservices with Java and Java EE
JavaOne 2016 - Reactive Microservices with Java and Java EE
 
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShiftReal-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
 
How lagom helps to build real world microservice systems
How lagom helps to build real world microservice systemsHow lagom helps to build real world microservice systems
How lagom helps to build real world microservice systems
 
Lagom in Practice
Lagom in PracticeLagom in Practice
Lagom in Practice
 
Compensating Transactions: When ACID is too much
Compensating Transactions: When ACID is too muchCompensating Transactions: When ACID is too much
Compensating Transactions: When ACID is too much
 
Azure service fabric: a gentle introduction
Azure service fabric: a gentle introductionAzure service fabric: a gentle introduction
Azure service fabric: a gentle introduction
 

Similar to Discovering NServiceBus Multi-Tenancy and Advanced Saga Persistence

Spring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenSpring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenJoshua Long
 
Integrating SAP the Java EE Way - JBoss One Day talk 2012
Integrating SAP the Java EE Way - JBoss One Day talk 2012Integrating SAP the Java EE Way - JBoss One Day talk 2012
Integrating SAP the Java EE Way - JBoss One Day talk 2012hwilming
 
Spring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud FoundrySpring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud FoundryJoshua Long
 
Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)Paco de la Cruz
 
Multi Client Development with Spring
Multi Client Development with SpringMulti Client Development with Spring
Multi Client Development with SpringJoshua Long
 
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...Dan Wahlin
 
Java Configuration Deep Dive with Spring
Java Configuration Deep Dive with SpringJava Configuration Deep Dive with Spring
Java Configuration Deep Dive with SpringJoshua Long
 
Developing web-apps like it's 2013
Developing web-apps like it's 2013Developing web-apps like it's 2013
Developing web-apps like it's 2013Laurent_VB
 
AWS January 2016 Webinar Series - Managing your Infrastructure as Code
AWS January 2016 Webinar Series - Managing your Infrastructure as CodeAWS January 2016 Webinar Series - Managing your Infrastructure as Code
AWS January 2016 Webinar Series - Managing your Infrastructure as CodeAmazon Web Services
 
Kick your database_to_the_curb_reston_08_27_19
Kick your database_to_the_curb_reston_08_27_19Kick your database_to_the_curb_reston_08_27_19
Kick your database_to_the_curb_reston_08_27_19confluent
 
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012Amazon Web Services
 
The use case of a scalable architecture
The use case of a scalable architectureThe use case of a scalable architecture
The use case of a scalable architectureToru Wonyoung Choi
 
Vertx - Reactive & Distributed
Vertx - Reactive & DistributedVertx - Reactive & Distributed
Vertx - Reactive & DistributedOrkhan Gasimov
 
Modern Android app library stack
Modern Android app library stackModern Android app library stack
Modern Android app library stackTomáš Kypta
 
Logisland "Event Mining at scale"
Logisland "Event Mining at scale"Logisland "Event Mining at scale"
Logisland "Event Mining at scale"Thomas Bailet
 
Futures and Rx Observables: powerful abstractions for consuming web services ...
Futures and Rx Observables: powerful abstractions for consuming web services ...Futures and Rx Observables: powerful abstractions for consuming web services ...
Futures and Rx Observables: powerful abstractions for consuming web services ...Chris Richardson
 
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...Anton Kirillov
 
Online Meetup: Why should container system / platform builders care about con...
Online Meetup: Why should container system / platform builders care about con...Online Meetup: Why should container system / platform builders care about con...
Online Meetup: Why should container system / platform builders care about con...Docker, Inc.
 
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel AvivSelf Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel AvivAmazon Web Services
 
Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30) Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30) Paco de la Cruz
 

Similar to Discovering NServiceBus Multi-Tenancy and Advanced Saga Persistence (20)

Spring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenSpring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in Heaven
 
Integrating SAP the Java EE Way - JBoss One Day talk 2012
Integrating SAP the Java EE Way - JBoss One Day talk 2012Integrating SAP the Java EE Way - JBoss One Day talk 2012
Integrating SAP the Java EE Way - JBoss One Day talk 2012
 
Spring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud FoundrySpring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud Foundry
 
Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)
 
Multi Client Development with Spring
Multi Client Development with SpringMulti Client Development with Spring
Multi Client Development with Spring
 
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
 
Java Configuration Deep Dive with Spring
Java Configuration Deep Dive with SpringJava Configuration Deep Dive with Spring
Java Configuration Deep Dive with Spring
 
Developing web-apps like it's 2013
Developing web-apps like it's 2013Developing web-apps like it's 2013
Developing web-apps like it's 2013
 
AWS January 2016 Webinar Series - Managing your Infrastructure as Code
AWS January 2016 Webinar Series - Managing your Infrastructure as CodeAWS January 2016 Webinar Series - Managing your Infrastructure as Code
AWS January 2016 Webinar Series - Managing your Infrastructure as Code
 
Kick your database_to_the_curb_reston_08_27_19
Kick your database_to_the_curb_reston_08_27_19Kick your database_to_the_curb_reston_08_27_19
Kick your database_to_the_curb_reston_08_27_19
 
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
 
The use case of a scalable architecture
The use case of a scalable architectureThe use case of a scalable architecture
The use case of a scalable architecture
 
Vertx - Reactive & Distributed
Vertx - Reactive & DistributedVertx - Reactive & Distributed
Vertx - Reactive & Distributed
 
Modern Android app library stack
Modern Android app library stackModern Android app library stack
Modern Android app library stack
 
Logisland "Event Mining at scale"
Logisland "Event Mining at scale"Logisland "Event Mining at scale"
Logisland "Event Mining at scale"
 
Futures and Rx Observables: powerful abstractions for consuming web services ...
Futures and Rx Observables: powerful abstractions for consuming web services ...Futures and Rx Observables: powerful abstractions for consuming web services ...
Futures and Rx Observables: powerful abstractions for consuming web services ...
 
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
 
Online Meetup: Why should container system / platform builders care about con...
Online Meetup: Why should container system / platform builders care about con...Online Meetup: Why should container system / platform builders care about con...
Online Meetup: Why should container system / platform builders care about con...
 
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel AvivSelf Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv
 
Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30) Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30)
 

More from Particular Software

Scaling for Success: Lessons from handling peak loads on Azure with NServiceBus
Scaling for Success: Lessons from handling peak loads on Azure with NServiceBusScaling for Success: Lessons from handling peak loads on Azure with NServiceBus
Scaling for Success: Lessons from handling peak loads on Azure with NServiceBusParticular Software
 
Beyond simple benchmarks—a practical guide to optimizing code
Beyond simple benchmarks—a practical guide to optimizing code Beyond simple benchmarks—a practical guide to optimizing code
Beyond simple benchmarks—a practical guide to optimizing code Particular Software
 
An exception occurred - Please try again
An exception occurred - Please try againAn exception occurred - Please try again
An exception occurred - Please try againParticular Software
 
Tales from the trenches creating complex distributed systems
Tales from the trenches  creating complex distributed systemsTales from the trenches  creating complex distributed systems
Tales from the trenches creating complex distributed systemsParticular Software
 
Implementing outbox model-checking first
Implementing outbox   model-checking firstImplementing outbox   model-checking first
Implementing outbox model-checking firstParticular Software
 
Reports from the field azure functions in practice
Reports from the field   azure functions in practiceReports from the field   azure functions in practice
Reports from the field azure functions in practiceParticular Software
 
Finding your service boundaries - a practical guide
Finding your service boundaries - a practical guideFinding your service boundaries - a practical guide
Finding your service boundaries - a practical guideParticular Software
 
Decomposing .NET Monoliths with NServiceBus and Docker
Decomposing .NET Monoliths with NServiceBus and DockerDecomposing .NET Monoliths with NServiceBus and Docker
Decomposing .NET Monoliths with NServiceBus and DockerParticular Software
 
DIY Async Message Pump: Lessons from the trenches
DIY Async Message Pump: Lessons from the trenchesDIY Async Message Pump: Lessons from the trenches
DIY Async Message Pump: Lessons from the trenchesParticular Software
 
Share the insight of ServiceInsight
Share the insight of ServiceInsightShare the insight of ServiceInsight
Share the insight of ServiceInsightParticular Software
 
What to consider when monitoring microservices
What to consider when monitoring microservicesWhat to consider when monitoring microservices
What to consider when monitoring microservicesParticular Software
 
Making communications across boundaries simple with NServiceBus
Making communications across boundaries simple with NServiceBusMaking communications across boundaries simple with NServiceBus
Making communications across boundaries simple with NServiceBusParticular Software
 
Making communication across boundaries simple with Azure Service Bus
Making communication across boundaries simple with Azure Service BusMaking communication across boundaries simple with Azure Service Bus
Making communication across boundaries simple with Azure Service BusParticular Software
 
How to avoid microservice pitfalls
How to avoid microservice pitfallsHow to avoid microservice pitfalls
How to avoid microservice pitfallsParticular Software
 
Connect front end to back end using SignalR and Messaging
Connect front end to back end using SignalR and MessagingConnect front end to back end using SignalR and Messaging
Connect front end to back end using SignalR and MessagingParticular Software
 
Async/Await: NServiceBus v6 API Update
Async/Await: NServiceBus v6 API UpdateAsync/Await: NServiceBus v6 API Update
Async/Await: NServiceBus v6 API UpdateParticular Software
 
Async/Await: TPL & Message Pumps
Async/Await: TPL & Message Pumps Async/Await: TPL & Message Pumps
Async/Await: TPL & Message Pumps Particular Software
 
Making workflow implementation easy with CQRS
Making workflow implementation easy with CQRSMaking workflow implementation easy with CQRS
Making workflow implementation easy with CQRSParticular Software
 

More from Particular Software (20)

Scaling for Success: Lessons from handling peak loads on Azure with NServiceBus
Scaling for Success: Lessons from handling peak loads on Azure with NServiceBusScaling for Success: Lessons from handling peak loads on Azure with NServiceBus
Scaling for Success: Lessons from handling peak loads on Azure with NServiceBus
 
Beyond simple benchmarks—a practical guide to optimizing code
Beyond simple benchmarks—a practical guide to optimizing code Beyond simple benchmarks—a practical guide to optimizing code
Beyond simple benchmarks—a practical guide to optimizing code
 
An exception occurred - Please try again
An exception occurred - Please try againAn exception occurred - Please try again
An exception occurred - Please try again
 
Tales from the trenches creating complex distributed systems
Tales from the trenches  creating complex distributed systemsTales from the trenches  creating complex distributed systems
Tales from the trenches creating complex distributed systems
 
Got the time?
Got the time?Got the time?
Got the time?
 
Implementing outbox model-checking first
Implementing outbox   model-checking firstImplementing outbox   model-checking first
Implementing outbox model-checking first
 
Reports from the field azure functions in practice
Reports from the field   azure functions in practiceReports from the field   azure functions in practice
Reports from the field azure functions in practice
 
Finding your service boundaries - a practical guide
Finding your service boundaries - a practical guideFinding your service boundaries - a practical guide
Finding your service boundaries - a practical guide
 
Decomposing .NET Monoliths with NServiceBus and Docker
Decomposing .NET Monoliths with NServiceBus and DockerDecomposing .NET Monoliths with NServiceBus and Docker
Decomposing .NET Monoliths with NServiceBus and Docker
 
DIY Async Message Pump: Lessons from the trenches
DIY Async Message Pump: Lessons from the trenchesDIY Async Message Pump: Lessons from the trenches
DIY Async Message Pump: Lessons from the trenches
 
Share the insight of ServiceInsight
Share the insight of ServiceInsightShare the insight of ServiceInsight
Share the insight of ServiceInsight
 
What to consider when monitoring microservices
What to consider when monitoring microservicesWhat to consider when monitoring microservices
What to consider when monitoring microservices
 
Making communications across boundaries simple with NServiceBus
Making communications across boundaries simple with NServiceBusMaking communications across boundaries simple with NServiceBus
Making communications across boundaries simple with NServiceBus
 
Making communication across boundaries simple with Azure Service Bus
Making communication across boundaries simple with Azure Service BusMaking communication across boundaries simple with Azure Service Bus
Making communication across boundaries simple with Azure Service Bus
 
How to avoid microservice pitfalls
How to avoid microservice pitfallsHow to avoid microservice pitfalls
How to avoid microservice pitfalls
 
Connect front end to back end using SignalR and Messaging
Connect front end to back end using SignalR and MessagingConnect front end to back end using SignalR and Messaging
Connect front end to back end using SignalR and Messaging
 
Async/Await: NServiceBus v6 API Update
Async/Await: NServiceBus v6 API UpdateAsync/Await: NServiceBus v6 API Update
Async/Await: NServiceBus v6 API Update
 
Async/Await: TPL & Message Pumps
Async/Await: TPL & Message Pumps Async/Await: TPL & Message Pumps
Async/Await: TPL & Message Pumps
 
Async/Await Best Practices
Async/Await Best PracticesAsync/Await Best Practices
Async/Await Best Practices
 
Making workflow implementation easy with CQRS
Making workflow implementation easy with CQRSMaking workflow implementation easy with CQRS
Making workflow implementation easy with CQRS
 

Recently uploaded

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
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
 

Recently uploaded (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
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...
 

Discovering NServiceBus Multi-Tenancy and Advanced Saga Persistence

  • 1. ~
  • 2. ~ Roy Cornelissen Software Architect @roycornelissen Mark Taling Lead Developer @marktaling
  • 3. Where we started Discovering NServiceBus Multi tenancy Saga’s The evolution of NServiceBus Performance considerations Maintainability NServiceBusin a brownfield Wrap up Q&A
  • 4. Integration Layer Service Layer NIS Presentation Layer Planning UI Reporting UI customer external apps Employee Self Service Common Forecast Realization Payment Schedule
  • 5. Monitoring & Control Integration Layer Service Layer NIS Presentation Layer Planning UI Reporting UI Employee Self Service Common Forecast Payment Schedule Service Bus Integration Services IS HRM IS Payroll IS Budget IS Provisioning IS Time IS Point of Sale Realization
  • 6.
  • 7. Tenant ID Tenant ID Tenant ID Tenant ID
  • 8. publicclassBuildPrincipalFromHeaders:IMutateIncomingMessages { publicobjectMutateIncoming(objectmessage) { Thread.CurrentPrincipal=null; stringtenantId=Headers.GetMessageHeader(message,“urn:dv:tenantid”); ICollection<Claim>claims=newList<Claim>(); … claims.Add(newClaim(SecurityConstants.TenantIdClaim,tenantId)); varprincipal=newClaimsPrincipal( newClaimsIdentityCollection{ newClaimsIdentity(claims) }); Thread.CurrentPrincipal=principal; returnmessage; } …
  • 9. publicclassSetHeadersFromPrincipal:IMutateOutgoingMessages { publicIBusBus{get;set;} publicobjectMutateOutgoing(objectmessage) { IClaimsIdentityidentity= Thread.CurrentPrincipal.IdentityasIClaimsIdentity; stringtenantId=identity.GetTenantId(); if(!string.IsNullOrWhiteSpace(tenantId)) { Bus.SetMessageHeader(message,“urn:dv:tenantid”,tenantId); } returnmessage; } …
  • 10. -Multiple properties -Concatenation -IFindSaga -ISagaPersister
  • 11.
  • 12. publicclassAdvancedRavenSagaPersister: RavenSagaPersister, ISagaPersister{ publicAdvancedRavenSagaPersister(RavenSessionFactorysessionFactory): base(sessionFactory) { } publicnewvoidSave(IContainSagaDatasaga) { base.Save(saga); } publicnewvoidComplete(IContainSagaDatasaga) { base.Complete(saga); } voidISagaPersister.Save(IContainSagaDatasaga) { Save(saga); } voidISagaPersister.Complete(IContainSagaDatasaga) { Complete(saga); } }
  • 13. publicclassAdvancedRavenSagaPersister: RavenSagaPersister, ISagaPersister{ publicAdvancedRavenSagaPersister(RavenSessionFactorysessionFactory): base(sessionFactory) { } publicnewvoidSave(IContainSagaDatasaga) { base.Save(saga); } publicnewvoidComplete(IContainSagaDatasaga) { base.Complete(saga); } voidISagaPersister.Save(IContainSagaDatasaga) { Save(saga); } voidISagaPersister.Complete(IContainSagaDatasaga) { Complete(saga); } }
  • 14. publicclassAdvancedRavenSagaPersister: RavenSagaPersister, ISagaPersister{ publicAdvancedRavenSagaPersister(RavenSessionFactorysessionFactory): base(sessionFactory) { } publicnewvoidSave(IContainSagaDatasaga) { base.Save(saga); StoreMappingKeys(saga); } publicnewvoidComplete(IContainSagaDatasaga) { RemoveMappingKeys(saga); base.Complete(saga); } voidISagaPersister.Save(IContainSagaDatasaga) { Save(saga); } voidISagaPersister.Complete(IContainSagaDatasaga) { Complete(saga); } }
  • 15. publicclassAdvancedRavenSagaPersister: RavenSagaPersister, ISagaPersister{ privatereadonlyRavenSessionFactory_sessionFactory; publicAdvancedRavenSagaPersister(RavenSessionFactorysessionFactory): base(sessionFactory) { _sessionFactory= sessionFactory; } publicnewvoidSave(IContainSagaDatasaga) { base.Save(saga); StoreMappingKeys(saga); } publicnewvoidComplete(IContainSagaDatasaga) { RemoveMappingKeys(saga); base.Complete(saga); } voidISagaPersister.Save(IContainSagaDatasaga) { Save(saga); } voidISagaPersister.Complete(IContainSagaDatasaga) { Complete(saga); } }
  • 16. publicclassAdvancedRavenSagaPersister: RavenSagaPersister, ISagaPersister{ privatereadonlyRavenSessionFactory_sessionFactory; publicAdvancedRavenSagaPersister(RavenSessionFactorysessionFactory): base(sessionFactory) { _sessionFactory= sessionFactory; } publicnewvoidSave(IContainSagaDatasaga) { base.Save(saga); StoreMappingKeys(saga); } publicnewvoidComplete(IContainSagaDatasaga) { RemoveMappingKeys(saga); base.Complete(saga); } voidISagaPersister.Save(IContainSagaDatasaga) { Save(saga); } voidISagaPersister.Complete(IContainSagaDatasaga) { Complete(saga); } } vardocument = _sessionFactory.Session.Include("SagaDocId").Load<SagaMappingIdentity>(mappingId); return_sessionFactory.Session.Load<TSagaData>(document.SagaId);
  • 17.
  • 18.
  • 19.
  • 20.
  • 22. Lessonslearned -Upgrade regularly -RetryPoCsandassumptions -Beware of abstractions
  • 23. Lessonslearned -Upgrade regularly -RetryPoCsandassumptions -Beware of abstractions
  • 24. Keep yourtransactions on a diet Design withparallelismin mind {Tx} [Unique] saga properties
  • 25. Keep yourtransactions on a diet Design withparallelismin mind {Tx} {Tx} [Unique] saga properties {Tx}
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 33. NServiceBusis an opinionatedframework If it fits, it fits like a glove Prepare to make concessionsat first Clean up later Messaging makes totally different use cases possible Requires a new mindsetfor everyone
  • 34. NServiceBusis a greatway tobreak open existingarchitectures Despiteitsflexibility andpluggability, alwaysfollow itsdesign principles Go withthe flow, itsolvesreal life problemsyoumightnotknowyouhave
  • 35. ~ Roy Cornelissen Software Architect @roycornelissen Mark Taling Lead Developer @marktaling blogs.infosupport.com