SlideShare a Scribd company logo
Yves Goeleven & Sean Feldman
Solution Architects & Azure MVPs
http://particular.net
Azure Service Bus & NServiceBus
Setting up communication across boundaries
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Secure & reliable communication
between software components
across network boundaries.
• Inside cloud services
• Between datacenters
• Between branch offices
• Hybrid solutions
• IoT & Mobile devices
When do you need Azure Service Bus ?

 
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Framework to simplify the
development of distributed
business and workflow
applications.
• .NET native workflow & pub/sub
• Simplicity, reliability, scalability
and performance
• Runs on premises, in the cloud, or
either
• Supports a wide range of
messaging transports, deals with
transport technology complexity
What is NServiceBus for?
Endpoint Endpoint
Transport
Azure Service Bus RabbitMQ MSMQSQL Server
ASQ SQS …
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
An Endpoint is a logical entity that
communicates with other Endpoints
via messaging.
Endpoint typically equates to a
process.
Each Endpoint
• Has an identifying name
• Contains a collection of Message
Handlers and Sagas
• Can be deployed to a number of
machines and environments
(instances)
NServiceBus – simple overview
Endpoint Endpoint
Transport
class PlaceOrder : ICommand
{
public Guid Id { get; set; }
public string Product { get; set; }
}
instance.Send(new PlaceOrder())
class Handler : IHandleMessages<PlaceOrder>
{
Task Handle(PlaceOrder message)
{
// your code here
}
}
Demo
https://docs.particular.net/samples/azure/azure-service-bus/
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Transport => MessagePump + Dispatcher ( + additional features)
Forked pipeline of behaviors (handler returns)
Some behaviors might invoke transactional resources like Persisters
Startup infrastructure (TransportDefinition, Feature, Installer, ...)
NServiceBus - endpoint internals
MessagePump
Dispatcher
Handler
Startup
Infrastructure
Connectivity
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Installer called at startup
TopologyCreator inquires Topology for what needs to be created
• For each entity in the topology constructs creator object
Which in turn uses namespace manager to create entities
• deals with all possible exceptions
Creation
Installer
Topology
TopologyCreator
Namespace
Manager
Queue,
Topic &
Subscription
Creators
SubscriptionManager
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
MessagePump & Dispatched inquire Topology to know what to receive from/send to
Pools of receivers, senders & factories (default poolsize = #cores)
Active lifecycle management (connection reestablished on drop)
Circuit breaker pattern
Connectivity Management
MessagePump Dispatcher
Pool of receivers Pool of senders
Pool of factories
SBMP over TCP SBMP over TCP
Context
LifecycleManager LifecycleManager
LifecycleManager
Circuit breaker
Topology
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Represents the layout of service bus entities that allow endpoints to
communicate.
• Explicit concept in transport so that it can be swapped.
• ASB’s forwarding feature provides near endless possibilities.
What is a topology?
Forwarding
Endpoint C
Endpoint A
Endpoint B
Topology
Let’s have a look at some
topologies
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Entity usage
• Commands vs Events
• Embed message types (f.e. filters, entity names)
• Does each namespace type support the entities used
• Native capabilities
Ownership
• Endpoints may not be aware of the full topology
• Awareness creates coupling, do you want that?
• Some entities may not belong to any endpoint
Performance impact
(Backwards) compatability
Multiple namespaces, Partitioning, HA
• No forwarding between namespaces
Things to consider for a topology
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Each endpoint has its own input queue
Sends direct to input queue, does not leverage pub/sub capabilities of
ASB, instead uses storage driven publishing from NSB
Basic topology
Endpoint C
Endpoint B
Endpoint A
Sphere of ownership
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Basic topology: pros and cons
Pros Cons
Simple mode No native pub/sub
Can leverage any messaging namespace
type (Basic, standard, premium)
Publisher coupled to subscriber (in both
directions)
Easy to port from MSMQ External dependency on storage
Integrates with auto-scale No native auditing on commands/events
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Each endpoint has its own input queue & topic
Sends direct to input queue, publish via topic
Endpoint oriented topology
Endpoint C
Endpoint B
Endpoint A
EndpointC.TypeA
EndpointB.TypeA
EndpointB.TypeB
EndpointA.Events
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Endpoint oriented topology: pros and cons
Pros Cons
Publisher decoupled from subscribers Subscribers coupled to Publishers
No dependency on storage Hard to use polymorphic events
Cannot handle changes in event hierarchy
Possible event overflow
Integrates with auto-scale Auto-scale for input queue only
Can not leverage basic namespace
Native auditing on events Native auditing on events very hard
No native auditing on commands
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Each endpoint has its own input queue, shared topics for publishing
Sends direct to input queue, publish via topic
Forwarding topology
Endpoint C
Endpoint B
Endpoint A
Type A
Type A
Type B
EndpointB
EndpointC
Bundle-1
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Forwarding topology: pros and cons
Pros Cons
No dependency on storage Can not leverage basic namespace
No coupling between publisher & subscriber No native auditing on commands
Supports polymorphism
Change in message hierarchy is
transparent
Integrates with auto-scale
Protected against overflow
Native auditing on events
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Each endpoint has its own input topic, shared topics for publishing
Sends direct to input topic, publish via topic
“Topic all the things” topology
Endpoint C
Endpoint B
Endpoint A
Type A
Type A
Type B
Bundle-1
EndpointB
EndpointC
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
“Topic all the things” topology: pros and cons
Pros Cons
No dependency on storage Can not leverage basic namespace
No coupling between publisher & subscriber Does not integrate with auto-scale
Supports polymorphism
Change in message hierarchy is
transparent
Protected against overflow
Native auditing on commands & events
Reliable Message Exchange:
Receiving
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
1. Unreliable – TXs disabled
2. Receive Only – transport TXs
3. Sends atomic with Receive
4. Transaction Scope – Distributed TXs
NSB Transaction Modes
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
ReceiveAndDelete receive
mode
Not recommended as when
failures occur, messages will
be permanently lost.
Use case: telemetry
Transaction Mode: Unreliable
Endpoint
Receive And Delete
 Delete
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
PeekLock receive mode
Partial results
- Updates to data stores
- Message sends
Higher performance
HA – multiple namespaces
Transaction Mode: Receive Only
Endpoint
DLQ
Temporal Lock
 Delete
Endpoint
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
PeekLock receive mode +
transaction + send via
No ghost messages
BUT, data is not included
in transport transaction (data
should have its own
transaction)
Transaction Mode: Sends atomic with Receive
Message
Receiver DLQ
Temporal Lock
 Delete
Message
Sender
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Send via requires transaction scope
That scope does not allow other transactional resources inside it
Requires strategic suppress scopes in the pipeline to work
Transaction Mode: Sends atomic with Receive
MessagePump
Dispatcher
Handler
Via scope
wraps pipeline
invocation
Suppress scope
wraps Handler
scope
Connections
enlists in Handler
scope
Enlists in Via
scope
Connections must
be wrapped in
suppress scope
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
DTC is not supported by ASB
Transaction Mode: Transaction Scope
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
- Successfully processed messages go to Audit queue
- Recoverability for failed messages
- Immediate retries
- Delayed retries
Messages failed all retries go to Error queue
Total Number of Attempts
Business errors
(ImmediateRetries:NumberOfRetries + 1) x (DelayedRetries:NumberOfRetries + 1)
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Poisonous messages are
dead lettered w/o retries
Messages with number of
immediate retries bigger than
entity`s delivery will dead
letter.
Poisonous & dead-lettered messages
Example:
Immediate retries set to X
Entity`s DeliveryCount set to X-1
Unsupported Transport
encoding (i.e. not stream or
byte[])
Reliable Message Exchange:
Sending
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Default dispatch mode: batched
Dispatch Mode
Endpoint A Endpoint B
Namespace
Batch
Endpoint A Endpoint B
Namespace Batch
Optional (explicit): immediate
1
2
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Each namespace is sent separately
Dispatching to multiple namespaces
Endpoint B
Namespace 1
Endpoint C
Namespace 2
Batch
Batch
Endpoint A
Batch
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Batch size is estimated using padding percentage. Default
padding: 5%.
Calculated message size
= Raw body size
+ Custom headers size (keys + values)
+ Standard properties estimated size
+ padding %
Batch Size
Body Size
Custom Headers
(keys + values)
Standard
Properties
(estimated)
Padding %
Body Size
Custom Headers
(keys + values)
Standard
Properties
(estimated)
Padding %
…
Body Size
Custom Headers
(keys + values)
Standard
Properties
(estimated)
Padding %
Body Size
Custom Headers
(keys + values)
Standard
Properties
(estimated)
Padding %
…
Up to MAX_SIZE or 100 messages
…
Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus
Defaults & what needs to be considered if really high perf is required
• Awaiting for combined Tasks vs individual tasks
• Number of Factories and clients, concurrency, prefetch
Performance Tuning
Demo
https://docs.particular.net/samples/azure/performance-tuning-asb/
Thank you
Q&A

More Related Content

PPTX
Introduction to NServiceBus
PPTX
Making communication across boundaries simple with Azure Service Bus
PPTX
What to consider when monitoring microservices
PPTX
NServiceBus - introduction to a message based distributed architecture
PPTX
NServiceBus - building a distributed system based on a messaging infrastructure
PPTX
Windows Azure Service Bus
PPTX
Beyond REST and RPC: Asynchronous Eventing and Messaging Patterns
PPT
Apache ActiveMQ - Enterprise messaging in action
Introduction to NServiceBus
Making communication across boundaries simple with Azure Service Bus
What to consider when monitoring microservices
NServiceBus - introduction to a message based distributed architecture
NServiceBus - building a distributed system based on a messaging infrastructure
Windows Azure Service Bus
Beyond REST and RPC: Asynchronous Eventing and Messaging Patterns
Apache ActiveMQ - Enterprise messaging in action

What's hot (20)

PDF
Introduction to NServiceBus
PPTX
RabbitMq
ODP
Apache ActiveMQ and Apache Camel
ODP
Art Of Message Queues
PDF
Enterprise Messaging with Apache ActiveMQ
PPTX
Message Oriented Architecture using NServiceBus
PDF
Do More With Message Queue
ODP
The Art of Message Queues - TEKX
ZIP
ProcessOne Push Platform: XMPP-based Push Solutions
PDF
Messaging With Apache ActiveMQ
PDF
XMPP Academy #1
PPTX
Spring JMS and ActiveMQ
PDF
Queues queues queues — How RabbitMQ enables reactive architectures
PDF
Rabbitmq basics
PDF
Introduction to Apache ActiveMQ Artemis
PPT
IBM WebSphere MQ: Managing Workloads, Scaling and Availability with MQ Clusters
PPTX
Message queues
PDF
IBM MQ: Managing Workloads, Scaling and Availability with MQ Clusters
PDF
Apache ActiveMQ and Apache ServiceMix
PPTX
Rabbitmq & Kafka Presentation
Introduction to NServiceBus
RabbitMq
Apache ActiveMQ and Apache Camel
Art Of Message Queues
Enterprise Messaging with Apache ActiveMQ
Message Oriented Architecture using NServiceBus
Do More With Message Queue
The Art of Message Queues - TEKX
ProcessOne Push Platform: XMPP-based Push Solutions
Messaging With Apache ActiveMQ
XMPP Academy #1
Spring JMS and ActiveMQ
Queues queues queues — How RabbitMQ enables reactive architectures
Rabbitmq basics
Introduction to Apache ActiveMQ Artemis
IBM WebSphere MQ: Managing Workloads, Scaling and Availability with MQ Clusters
Message queues
IBM MQ: Managing Workloads, Scaling and Availability with MQ Clusters
Apache ActiveMQ and Apache ServiceMix
Rabbitmq & Kafka Presentation
Ad

Viewers also liked (11)

PDF
W poszukiwaniu procesu doskonałego. Wdrożenie Scruma, Continuous Integrations...
PDF
Embracing Nservicebus Best Practices
PPT
SOA with NServiceBus 20130124
PDF
HTTPS bez wymówek
PDF
NServiceBus Alt.Net 20100511
PDF
Real time event feeds with NServiceBus and SignalR
PDF
Building a Highly Scalable File Processing Platform with NServiceBus NSBCon b...
PPTX
Agile days 2010 человеческий фактор и agile
PDF
Azure storage queues czy azure service bus, oto jest pytanie
PDF
Wszystko, co chcielibyście wiedzieć o komunikacji przez kolejki, ale baliście...
PDF
HTTPS bez wymówek
W poszukiwaniu procesu doskonałego. Wdrożenie Scruma, Continuous Integrations...
Embracing Nservicebus Best Practices
SOA with NServiceBus 20130124
HTTPS bez wymówek
NServiceBus Alt.Net 20100511
Real time event feeds with NServiceBus and SignalR
Building a Highly Scalable File Processing Platform with NServiceBus NSBCon b...
Agile days 2010 человеческий фактор и agile
Azure storage queues czy azure service bus, oto jest pytanie
Wszystko, co chcielibyście wiedzieć o komunikacji przez kolejki, ale baliście...
HTTPS bez wymówek
Ad

Similar to Making communications across boundaries simple with NServiceBus (20)

PPTX
NServiceBus in Azure - A Right Tool for the Web(Job)?
PPTX
Intro to Azure Service Bus
PPTX
Cloud Messaging with NServiceBus and Microsoft Azure
PPTX
Best Features of Azure Service Bus
PDF
Windows azure service bus reference
PPTX
NServiceBus
PPTX
Designing distributed, scalable and reliable systems using NServiceBus
PPTX
Calgary azure dev camp - Service Bus
PPTX
NSBCon UK nservicebus on Azure by Yves Goeleven
PPTX
GWAB - Hop on the Service Bus!
PPTX
Windows Azure Service Bus
PPTX
Introduction to Azure Service Bus Presentation
PPTX
The top integration features you probably didn’t know existed in Service Bus
PPTX
Messaging Powered Front Ends
PPTX
NServiceBus introduction
PPTX
Introduction to Windows Azure Service Bus Relay Service
DOCX
Azure Service Bus Performance Checklist
PPTX
Azure Service Bus
PDF
Middleware in the cloud platform-v2
PPTX
Azure service bus based on cloud computing
NServiceBus in Azure - A Right Tool for the Web(Job)?
Intro to Azure Service Bus
Cloud Messaging with NServiceBus and Microsoft Azure
Best Features of Azure Service Bus
Windows azure service bus reference
NServiceBus
Designing distributed, scalable and reliable systems using NServiceBus
Calgary azure dev camp - Service Bus
NSBCon UK nservicebus on Azure by Yves Goeleven
GWAB - Hop on the Service Bus!
Windows Azure Service Bus
Introduction to Azure Service Bus Presentation
The top integration features you probably didn’t know existed in Service Bus
Messaging Powered Front Ends
NServiceBus introduction
Introduction to Windows Azure Service Bus Relay Service
Azure Service Bus Performance Checklist
Azure Service Bus
Middleware in the cloud platform-v2
Azure service bus based on cloud computing

More from Particular Software (20)

PDF
Scaling for Success: Lessons from handling peak loads on Azure with NServiceBus
PDF
Beyond simple benchmarks—a practical guide to optimizing code
PDF
An exception occurred - Please try again
PPTX
Tales from the trenches creating complex distributed systems
PPTX
Got the time?
PPTX
Implementing outbox model-checking first
PPTX
Reports from the field azure functions in practice
PPTX
Finding your service boundaries - a practical guide
PPTX
Decomposing .NET Monoliths with NServiceBus and Docker
PDF
DIY Async Message Pump: Lessons from the trenches
PDF
Share the insight of ServiceInsight
PPTX
How to avoid microservice pitfalls
PDF
Connect front end to back end using SignalR and Messaging
PDF
Async/Await: NServiceBus v6 API Update
PDF
Async/Await: TPL & Message Pumps
PDF
Async/Await Best Practices
PPTX
Making workflow implementation easy with CQRS
PPTX
Cqrs but different
PPTX
Asynchronous Messaging with NServiceBus
PPTX
Beyond the POC: Adopting NServiceBus
Scaling for Success: Lessons from handling peak loads on Azure with NServiceBus
Beyond simple benchmarks—a practical guide to optimizing code
An exception occurred - Please try again
Tales from the trenches creating complex distributed systems
Got the time?
Implementing outbox model-checking first
Reports from the field azure functions in practice
Finding your service boundaries - a practical guide
Decomposing .NET Monoliths with NServiceBus and Docker
DIY Async Message Pump: Lessons from the trenches
Share the insight of ServiceInsight
How to avoid microservice pitfalls
Connect front end to back end using SignalR and Messaging
Async/Await: NServiceBus v6 API Update
Async/Await: TPL & Message Pumps
Async/Await Best Practices
Making workflow implementation easy with CQRS
Cqrs but different
Asynchronous Messaging with NServiceBus
Beyond the POC: Adopting NServiceBus

Recently uploaded (20)

PDF
Understanding Forklifts - TECH EHS Solution
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
Essential Infomation Tech presentation.pptx
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Digital Strategies for Manufacturing Companies
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
ai tools demonstartion for schools and inter college
PDF
System and Network Administration Chapter 2
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Understanding Forklifts - TECH EHS Solution
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Which alternative to Crystal Reports is best for small or large businesses.pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Odoo Companies in India – Driving Business Transformation.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Essential Infomation Tech presentation.pptx
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
CHAPTER 2 - PM Management and IT Context
2025 Textile ERP Trends: SAP, Odoo & Oracle
Digital Strategies for Manufacturing Companies
How Creative Agencies Leverage Project Management Software.pdf
How to Migrate SBCGlobal Email to Yahoo Easily
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Operating system designcfffgfgggggggvggggggggg
ai tools demonstartion for schools and inter college
System and Network Administration Chapter 2
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...

Making communications across boundaries simple with NServiceBus

  • 1. Yves Goeleven & Sean Feldman Solution Architects & Azure MVPs http://particular.net Azure Service Bus & NServiceBus Setting up communication across boundaries
  • 2. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Secure & reliable communication between software components across network boundaries. • Inside cloud services • Between datacenters • Between branch offices • Hybrid solutions • IoT & Mobile devices When do you need Azure Service Bus ?   
  • 3. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Framework to simplify the development of distributed business and workflow applications. • .NET native workflow & pub/sub • Simplicity, reliability, scalability and performance • Runs on premises, in the cloud, or either • Supports a wide range of messaging transports, deals with transport technology complexity What is NServiceBus for? Endpoint Endpoint Transport Azure Service Bus RabbitMQ MSMQSQL Server ASQ SQS …
  • 4. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus An Endpoint is a logical entity that communicates with other Endpoints via messaging. Endpoint typically equates to a process. Each Endpoint • Has an identifying name • Contains a collection of Message Handlers and Sagas • Can be deployed to a number of machines and environments (instances) NServiceBus – simple overview Endpoint Endpoint Transport class PlaceOrder : ICommand { public Guid Id { get; set; } public string Product { get; set; } } instance.Send(new PlaceOrder()) class Handler : IHandleMessages<PlaceOrder> { Task Handle(PlaceOrder message) { // your code here } }
  • 6. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Transport => MessagePump + Dispatcher ( + additional features) Forked pipeline of behaviors (handler returns) Some behaviors might invoke transactional resources like Persisters Startup infrastructure (TransportDefinition, Feature, Installer, ...) NServiceBus - endpoint internals MessagePump Dispatcher Handler Startup Infrastructure
  • 8. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Installer called at startup TopologyCreator inquires Topology for what needs to be created • For each entity in the topology constructs creator object Which in turn uses namespace manager to create entities • deals with all possible exceptions Creation Installer Topology TopologyCreator Namespace Manager Queue, Topic & Subscription Creators SubscriptionManager
  • 9. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus MessagePump & Dispatched inquire Topology to know what to receive from/send to Pools of receivers, senders & factories (default poolsize = #cores) Active lifecycle management (connection reestablished on drop) Circuit breaker pattern Connectivity Management MessagePump Dispatcher Pool of receivers Pool of senders Pool of factories SBMP over TCP SBMP over TCP Context LifecycleManager LifecycleManager LifecycleManager Circuit breaker Topology
  • 10. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Represents the layout of service bus entities that allow endpoints to communicate. • Explicit concept in transport so that it can be swapped. • ASB’s forwarding feature provides near endless possibilities. What is a topology? Forwarding Endpoint C Endpoint A Endpoint B Topology
  • 11. Let’s have a look at some topologies
  • 12. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Entity usage • Commands vs Events • Embed message types (f.e. filters, entity names) • Does each namespace type support the entities used • Native capabilities Ownership • Endpoints may not be aware of the full topology • Awareness creates coupling, do you want that? • Some entities may not belong to any endpoint Performance impact (Backwards) compatability Multiple namespaces, Partitioning, HA • No forwarding between namespaces Things to consider for a topology
  • 13. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Each endpoint has its own input queue Sends direct to input queue, does not leverage pub/sub capabilities of ASB, instead uses storage driven publishing from NSB Basic topology Endpoint C Endpoint B Endpoint A Sphere of ownership
  • 14. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Basic topology: pros and cons Pros Cons Simple mode No native pub/sub Can leverage any messaging namespace type (Basic, standard, premium) Publisher coupled to subscriber (in both directions) Easy to port from MSMQ External dependency on storage Integrates with auto-scale No native auditing on commands/events
  • 15. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Each endpoint has its own input queue & topic Sends direct to input queue, publish via topic Endpoint oriented topology Endpoint C Endpoint B Endpoint A EndpointC.TypeA EndpointB.TypeA EndpointB.TypeB EndpointA.Events
  • 16. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Endpoint oriented topology: pros and cons Pros Cons Publisher decoupled from subscribers Subscribers coupled to Publishers No dependency on storage Hard to use polymorphic events Cannot handle changes in event hierarchy Possible event overflow Integrates with auto-scale Auto-scale for input queue only Can not leverage basic namespace Native auditing on events Native auditing on events very hard No native auditing on commands
  • 17. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Each endpoint has its own input queue, shared topics for publishing Sends direct to input queue, publish via topic Forwarding topology Endpoint C Endpoint B Endpoint A Type A Type A Type B EndpointB EndpointC Bundle-1
  • 18. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Forwarding topology: pros and cons Pros Cons No dependency on storage Can not leverage basic namespace No coupling between publisher & subscriber No native auditing on commands Supports polymorphism Change in message hierarchy is transparent Integrates with auto-scale Protected against overflow Native auditing on events
  • 19. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Each endpoint has its own input topic, shared topics for publishing Sends direct to input topic, publish via topic “Topic all the things” topology Endpoint C Endpoint B Endpoint A Type A Type A Type B Bundle-1 EndpointB EndpointC
  • 20. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus “Topic all the things” topology: pros and cons Pros Cons No dependency on storage Can not leverage basic namespace No coupling between publisher & subscriber Does not integrate with auto-scale Supports polymorphism Change in message hierarchy is transparent Protected against overflow Native auditing on commands & events
  • 22. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus 1. Unreliable – TXs disabled 2. Receive Only – transport TXs 3. Sends atomic with Receive 4. Transaction Scope – Distributed TXs NSB Transaction Modes
  • 23. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus ReceiveAndDelete receive mode Not recommended as when failures occur, messages will be permanently lost. Use case: telemetry Transaction Mode: Unreliable Endpoint Receive And Delete  Delete
  • 24. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus PeekLock receive mode Partial results - Updates to data stores - Message sends Higher performance HA – multiple namespaces Transaction Mode: Receive Only Endpoint DLQ Temporal Lock  Delete
  • 25. Endpoint Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus PeekLock receive mode + transaction + send via No ghost messages BUT, data is not included in transport transaction (data should have its own transaction) Transaction Mode: Sends atomic with Receive Message Receiver DLQ Temporal Lock  Delete Message Sender
  • 26. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Send via requires transaction scope That scope does not allow other transactional resources inside it Requires strategic suppress scopes in the pipeline to work Transaction Mode: Sends atomic with Receive MessagePump Dispatcher Handler Via scope wraps pipeline invocation Suppress scope wraps Handler scope Connections enlists in Handler scope Enlists in Via scope Connections must be wrapped in suppress scope
  • 27. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus DTC is not supported by ASB Transaction Mode: Transaction Scope
  • 28. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus - Successfully processed messages go to Audit queue - Recoverability for failed messages - Immediate retries - Delayed retries Messages failed all retries go to Error queue Total Number of Attempts Business errors (ImmediateRetries:NumberOfRetries + 1) x (DelayedRetries:NumberOfRetries + 1)
  • 29. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Poisonous messages are dead lettered w/o retries Messages with number of immediate retries bigger than entity`s delivery will dead letter. Poisonous & dead-lettered messages Example: Immediate retries set to X Entity`s DeliveryCount set to X-1 Unsupported Transport encoding (i.e. not stream or byte[])
  • 31. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Default dispatch mode: batched Dispatch Mode Endpoint A Endpoint B Namespace Batch Endpoint A Endpoint B Namespace Batch Optional (explicit): immediate 1 2
  • 32. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Each namespace is sent separately Dispatching to multiple namespaces Endpoint B Namespace 1 Endpoint C Namespace 2 Batch Batch Endpoint A Batch
  • 33. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Batch size is estimated using padding percentage. Default padding: 5%. Calculated message size = Raw body size + Custom headers size (keys + values) + Standard properties estimated size + padding % Batch Size Body Size Custom Headers (keys + values) Standard Properties (estimated) Padding % Body Size Custom Headers (keys + values) Standard Properties (estimated) Padding % … Body Size Custom Headers (keys + values) Standard Properties (estimated) Padding % Body Size Custom Headers (keys + values) Standard Properties (estimated) Padding % … Up to MAX_SIZE or 100 messages …
  • 34. Introduction to ServiceInsight for NServiceBusNServiceBus & Azure Service Bus Defaults & what needs to be considered if really high perf is required • Awaiting for combined Tasks vs individual tasks • Number of Factories and clients, concurrency, prefetch Performance Tuning
  • 37. Q&A