NServiceBus is a lightweight messaging framework for .NET that helps make distributed systems more reliable, scalable, and extensible using a message-oriented architecture. It provides transaction management, automatic retries on failure, and supports various queues including MSMQ. Messages are sent asynchronously in the form of commands or events. Commands are processed by a single endpoint while events can be published to multiple subscribers. This improves reliability over a traditional request/response model. The document discusses how NServiceBus can be used to address issues like transaction management and data consistency when processing orders across multiple services in a distributed system.
IBM MQ: Managing Workloads, Scaling and Availability with MQ ClustersDavid Ware
MQ Clustering can be used to solve many problems, from simplified administration and workload management in an MQ network, to horizontal scalability and continuous availability of messaging applications. This session will show the full range of uses of MQ Clusters to solve real problems, highlighting the underlying technology being used. A basic understanding of IBM MQ clustering would be beneficial.
IBM MQ: Managing Workloads, Scaling and Availability with MQ ClustersDavid Ware
MQ Clustering can be used to solve many problems, from simplified administration and workload management in an MQ network, to horizontal scalability and continuous availability of messaging applications. This session will show the full range of uses of MQ Clusters to solve real problems, highlighting the underlying technology being used. A basic understanding of IBM MQ clustering would be beneficial.
Using the JMS 2.0 API with Apache Pulsar - Pulsar Virtual Summit Europe 2021StreamNative
For a long time Java Messaging Service has been the API to handle messaging systems in the Java World, and now the messaging ecosystem is moving to the next generation of streaming services like Apache Pulsar.
Why? Because Pulsar is free, Open Source, Cloud Native and it comes with cool new features that are not well supported by traditional JMS vendors.
In this session you will see how to use Pulsar in a JakartaEE Web Application deployed on Apache TomEE via the JMS/EJB API, without installing any additional components to your cluster.
PPT concetrates on :
1. Introduction to RabbitMQ .
2. Difference between AMQP and JMS
3. Different types of exchanges
4. Routing Key and Binding concept
RabbitMQ is an open source message-broker software that originally implemented the Advanced Message Queuing Protocol (AMQP).it accepts and forwards messages.
Authentification par certificat (clear box)Ousmane BADJI
Les technologies dites « sans fils », la norme 802.11 en particulier, facilitent et réduisent le coût de connexion pour les réseaux de grandes tailles. La mise en œuvre des réseaux sans fils est facile, mais la sécurité des données qui y sont transmises n’est pas toujours assurée. Ainsi nous allons vous présenter RADIUS (Remote Authentification Dial-In User Service) qui est un protocole client-serveur, permettant de centraliser des données d'authentification.
Présentation de Zabbix, de son fonctionnement, de ses limitations et des bonnes pratiques à adopter, pour une utilisation dans le monitoring d'un réseau de PME.
Presentation in french of Zabbix, how it works, its limitations and some configuration best practices for monitoring a small company network.
Building Event-Driven Services with Apache Kafkaconfluent
Should you use REST to sew services together? Is it better to use a richer, brokered protocol? This practical talk will dig into how we piece services together in event driven systems, how we we use a distributed log to create a central, persistent narrative and what benefits we reap from doing so.
In ASP.NET Core 3.0 è stato introdotto il supporto a gRPC, una framework altamente performante per fare Remote Procedure Call (RPC). Leggero e molto efficiente, supportato da molti linguaggi, supporto ad una comunicazione bidirezionale, riduzione del consumo di banda...solo questi solo alcuni dei vantaggi che descrivono gRPC, e che durante la sessione cercheremo di capire se siano reali o meno.
Fatto sta che è una tecnologia assolutamente da conoscere e sfruttare nello sviluppo di app moderno, e non solamente in ambito web.
Codice: https://github.com/andreadottor/XE.Dottor.gRPC
Evento: https://www.xedotnet.org/eventi/grpc-and-c-optimising-night/
What we've learned from running a PostgreSQL managed service on KubernetesDoKC
In this talk, I will share some of our learnings from running a managed PostgreSQL/TimescaleDB service on Kubernetes on AWS for a little more than a year: I’ll start with the motivation of running managed PostgreSQL on Kubernetes, the benefits and drawbacks. I’ll describe the architecture of the managed PostgreSQL cloud on Kubernetes I’ll zoom in on how we solved some of the Kubernetes-specific issues within our cloud, such as upgrading extensions without downtimes, taming the dreaded OOM killer, and doing regular maintenance and PostgreSQL major upgrades. I’ll share how open-source tools from the PostgreSQL ecosystem helps us to run the service and explain how we use them in a slightly non-trivial way.
This talk was given by Oleksii Kliukin for DoK Day Europe @ KubeCon 2022.
IBM WebSphere MQ: Managing Workloads, Scaling and Availability with MQ ClustersDavid Ware
IBM WebSphere MQ Clustering can be used to solve many problems, from simplified administration and workload management in an MQ network, to horizontal scalability and continuous availability of messaging applications. This session will show the full range of uses of MQ Clusters to solve real problems, highlighting the underlying technology being used.
This has been superseded by http://www.slideshare.net/DavidWare1/ame-2273-mq-clustering-pdf
Making communication across boundaries simple with Azure Service BusParticular Software
There are times when you should consider setting up secure communications between your software components across network boundaries.
Here are just a few:
* Your application is enormous (e.g., the global deployment of a marketing site targeting billions of people)
* Remoteness (e.g., your company has branch office locations around the globe)
* Your network constraints prevent communication (e.g., your machines in Azure Cloud Services are unable to talk to each other directly)
* You don't know the network conditions (e.g., IoT or mobile devices)
Yves Goeleven and Sean Feldman show how to overcome such challenges using Azure Service Bus.
Using the JMS 2.0 API with Apache Pulsar - Pulsar Virtual Summit Europe 2021StreamNative
For a long time Java Messaging Service has been the API to handle messaging systems in the Java World, and now the messaging ecosystem is moving to the next generation of streaming services like Apache Pulsar.
Why? Because Pulsar is free, Open Source, Cloud Native and it comes with cool new features that are not well supported by traditional JMS vendors.
In this session you will see how to use Pulsar in a JakartaEE Web Application deployed on Apache TomEE via the JMS/EJB API, without installing any additional components to your cluster.
PPT concetrates on :
1. Introduction to RabbitMQ .
2. Difference between AMQP and JMS
3. Different types of exchanges
4. Routing Key and Binding concept
RabbitMQ is an open source message-broker software that originally implemented the Advanced Message Queuing Protocol (AMQP).it accepts and forwards messages.
Authentification par certificat (clear box)Ousmane BADJI
Les technologies dites « sans fils », la norme 802.11 en particulier, facilitent et réduisent le coût de connexion pour les réseaux de grandes tailles. La mise en œuvre des réseaux sans fils est facile, mais la sécurité des données qui y sont transmises n’est pas toujours assurée. Ainsi nous allons vous présenter RADIUS (Remote Authentification Dial-In User Service) qui est un protocole client-serveur, permettant de centraliser des données d'authentification.
Présentation de Zabbix, de son fonctionnement, de ses limitations et des bonnes pratiques à adopter, pour une utilisation dans le monitoring d'un réseau de PME.
Presentation in french of Zabbix, how it works, its limitations and some configuration best practices for monitoring a small company network.
Building Event-Driven Services with Apache Kafkaconfluent
Should you use REST to sew services together? Is it better to use a richer, brokered protocol? This practical talk will dig into how we piece services together in event driven systems, how we we use a distributed log to create a central, persistent narrative and what benefits we reap from doing so.
In ASP.NET Core 3.0 è stato introdotto il supporto a gRPC, una framework altamente performante per fare Remote Procedure Call (RPC). Leggero e molto efficiente, supportato da molti linguaggi, supporto ad una comunicazione bidirezionale, riduzione del consumo di banda...solo questi solo alcuni dei vantaggi che descrivono gRPC, e che durante la sessione cercheremo di capire se siano reali o meno.
Fatto sta che è una tecnologia assolutamente da conoscere e sfruttare nello sviluppo di app moderno, e non solamente in ambito web.
Codice: https://github.com/andreadottor/XE.Dottor.gRPC
Evento: https://www.xedotnet.org/eventi/grpc-and-c-optimising-night/
What we've learned from running a PostgreSQL managed service on KubernetesDoKC
In this talk, I will share some of our learnings from running a managed PostgreSQL/TimescaleDB service on Kubernetes on AWS for a little more than a year: I’ll start with the motivation of running managed PostgreSQL on Kubernetes, the benefits and drawbacks. I’ll describe the architecture of the managed PostgreSQL cloud on Kubernetes I’ll zoom in on how we solved some of the Kubernetes-specific issues within our cloud, such as upgrading extensions without downtimes, taming the dreaded OOM killer, and doing regular maintenance and PostgreSQL major upgrades. I’ll share how open-source tools from the PostgreSQL ecosystem helps us to run the service and explain how we use them in a slightly non-trivial way.
This talk was given by Oleksii Kliukin for DoK Day Europe @ KubeCon 2022.
IBM WebSphere MQ: Managing Workloads, Scaling and Availability with MQ ClustersDavid Ware
IBM WebSphere MQ Clustering can be used to solve many problems, from simplified administration and workload management in an MQ network, to horizontal scalability and continuous availability of messaging applications. This session will show the full range of uses of MQ Clusters to solve real problems, highlighting the underlying technology being used.
This has been superseded by http://www.slideshare.net/DavidWare1/ame-2273-mq-clustering-pdf
Making communication across boundaries simple with Azure Service BusParticular Software
There are times when you should consider setting up secure communications between your software components across network boundaries.
Here are just a few:
* Your application is enormous (e.g., the global deployment of a marketing site targeting billions of people)
* Remoteness (e.g., your company has branch office locations around the globe)
* Your network constraints prevent communication (e.g., your machines in Azure Cloud Services are unable to talk to each other directly)
* You don't know the network conditions (e.g., IoT or mobile devices)
Yves Goeleven and Sean Feldman show how to overcome such challenges using Azure Service Bus.
Moving "Something Simple" To The Cloud - What It Really TakesCloverDX
On-Demand Webinar slides
We'll examine the difference between deploying on-premise, the "VM way" and the fully-cloud way. Take a behind-the-scenes look at a real-life case, where a requirement from several business units triggered a hasty implementation at first, then raised some fundamental questions, and eventually lead to a cascade of decisions and an AWS cloud solution that works (but no one anticipated).
Watch the webinar here: https://www.cloverdx.com/gc/lp/webinar/moving-something-simple-to-cloud-from-on-premise
These are the slides from my talk at the Norwegian Developer conference in Oslo 2013 on why unit testing is not necessarily the best way to test our code.
Publish & Subscribe to events using an Event AggregatorLars-Erik Kindblad
These slides gives guides you through what the Publish-Subscribe pattern is, how to create an Event Aggregator, how you can use it in the UI and in other layers and 2 code samples that refactors from a non pub-sub architecture to a pub-sub architecture.
The Single Responsibility Principle (SRP) is one of the 5 SOLID principles. These slides gives you an overview of the principle as well as a refactoring from a non-SRP code to a SRP-code.
This presentation goes through what Inversion of Control is, which IOC patterns that exists, which of the patterns you should use and when you should use them.
A presentation on layered software architecture that goes through logical layering and physical layering, the difference between those two and a practical example.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
2. What is NServiceBus?
Lightweight messaging framework for designing distributed systems in
.NET
An Enterprise Service Bus
Helps to make distributed systems more
Reliable
Scalable
Extensible
Founded in 2006 by UDI Dahan, an international renowned expert on
software architecture and design
Services and support provided by Particular Software
Open Source but not free
Source code available at https://github.com/Particular/NServiceBus
Binaries available as NuGet packages
3. Remote Procedure Call (Request/Response)
Request: Order
Website
Response: Order ID
Order Service
PlaceOrder(order)
Synchronous – The website is blocked while calling the Order Service
Messaged Oriented Architecture (One-way messaging)
Message: PlaceOrder
Website
Message Queue
Connect
Receive
PlaceOrder message
Windows Service
Process the PlaceOrder message
Asynchronous – The website is NOT blocked while the place order is processed
4. NServiceBus Terminology & Components
Sender
/Send-Only
Endpoint
Message,
Command
or Event
Message: PlaceOrder
Website
Message Queue
Connect
Receive
PlaceOrder message
Windows Service
Process the PlaceOrder message
Message Handler
Worker
Endpoint,
Host or
Receiver
5. Messages in NServiceBus
Just simple .NET classes with properties
2 types of messages
Command
• Do something: PlaceOrder
• Sent from one or more senders, processed by one endpoint
• Implement ICommand
Event
• Something has happened: OrderWasPlaced
• Published from one sender, processed by several endpoints/subscribers
• Implement IEvent
6. Command
Strongly coupled to
the receiving
endpoint
Command: PlaceOrder
Website
Command: PlaceOrder
Message Queue
Endpoint
Event (Publish/Subscribe)
Subscribing
Endpoint
Loosely coupled to
the receiving
endpoints
Event: OrderWasPlaced
Worker
NServiceBus will add 3
messages to the
queue, one for each
subscriber
Event: OrderWasPlaced
Message Queue
Subscribing
Endpoint
Subscribing
Endpoint
7. Queues
First in-first out datastructure for storing and retrieving messages
PlaceOrder message 4
First-In
Queue
PlaceOrder message 3
PlaceOrder message 2
PlaceOrder message 1
First-Out
Default queue in NServiceBus is Microsoft Message Queuing (MSMQ)
Available on all Windows editions since NT 4 and Windows 95
Also support for
ActiveMQ
RabbitMQ
SQL Server
Windows Azure Queues
Windows Azure ServiceBus
One endpoint has one queue, Send-Only endspoints do not have queues
8. How to Send & Handle Messages
Command: PlaceOrder
Website
Send
Command: PlaceOrder
Message Queue
Endpoint
Handle
(Command or Event)
9. Summary
Sender endpoint
Sends a message
Can be a website, desktop application or even a worker endpoint
Command
Message where we want to do something concrete
ICommand interface
Event
Message where we notify about something that has happened
IEvent interface
Message handler
Processes a given message
IHandleMessages<Message> interface
Worker endpoint
Finds and executes the handler for the message
Can be a Windows Service, console application, WCF, website
10. NServiceBus Requirements
MSMQ (default) or any other supported queue
ActiveMQ
RabbitMQ
SQL Server
Windows Azure Queues
Windows Azure ServiceBus
Distributed Transaction Cordinator (DTC)
RavenDB (default) or a relational database
Download the installer from NServiceBus from http://particular.net/ to
setup the required components
11. NuGet packages
NServiceBus Interfaces
Interfaces that we need to define messages
NServiceBus
Most of the code that drives NServiceBus except hosting
Use for send-only endpoints
NServiceBus Host
Console application that can be installed as a Windows Service
Used to process/handle messages
NServiceBus Testing
Framework for testing NServiceBus endpoints
12. The Case – The eBook Shop
1. Create the order in the
database
2. Auto-pay the order using a
previously stored credit
card
3. Send an order confirmation
by e-mail
4. Deliver the book to the
Windows Phone device
13. The Usual Way - Request/Response
Place order
1. Add order
Browser
OrderController
Confirmation page
with order ID
Database
2. Charge credit card
PaymentService
3. Send mail
SMTP-Server
4. Deliver ebook
DeviceService
14. Problem #1 – The order is lost during an error
Place order
1. Add order
Browser
OrderController
Database
Error page
Exception
2. Charge credit card
Error
PaymentService
3. Send mail
SMTP-Server
4. Deliver ebook
DeviceService
Conseqence
The database is rolled back
User receives an error
Order must be sent again
15. Problem #2 – Poor Transaction Management
Place order
1. Add order
Browser
OrderController
Database
Error page
2. Charge credit card
PaymentService
3. Send mail
SMTP-Server
Exception
4. Deliver ebook
Error
DeviceService
Conseqence:
The credit card is charged (no transaction support)
A mail saying the order was successful was sent (no transaction support)
The order do not exist in the database (supports transaction – rolled back)
The user will receive an error
16. Let’s Fix This With NServiceBus
Change to a message oriented architecture
Add PlaceOrder
message
Place order
Browser
Queue
OrderController
Confirmation page
Old
New
17. The Message Must Also Be Processed
MSMQ
1. Connect
2. Receive message PlaceOrder
Worker
(Windows Service)
PlaceOrder
3. PlaceOrder
Message Handler
4. Add order
Database
5. Charge credit card
PaymentService
6. Send mail
SMTP-Server
7. Deliver ebook
DeviceService
18. When an Error Occur
4. Rollback. Put the message
back on the queue
and retry
MSMQ
1. Connect
2. Receive message
PlaceOrder
Worker
(Windows Service)
PlaceOrder
3. PlaceOrder
Error
Message Handler
19. More about MSMQ
Max 4MB message size
Persists messages to files. Default location C:WINDOWSSystem32msmqstorage
Guranteed once-and-only-once delivery
The message will only be handled once
Supports transactional queues and distributed transactions (using DTC)
If an error occur both changes to the database and to the queue can be rolled back
Supports store-and-forward
MSMQ will store messages locally before forwarding it to the queue on another server
MSMQ will confirm when the message has been written to the disk in the outgoing
queue, not when it has been delivered to the server
Important feature for distributed systems with unrealiable networks
Server A
Sender
MSMQ
Outgoing
queue
Server B
Message
MSMQ
Input
queue
Worker
20. How NServiceBus Handles Failure
Transaction management and rollback are automatically handled by
NServiceBus in message handlers
When an error occur
1. The message is put back on the queue
2. Attempt to process the message 5 times, wait for 10 seconds
3. Attempt to process the message 5 times, wait for 20 seconds
4. Attempt to process the message 5 times, wait for 30 seconds
5. Attempt to process the message 5 times, send the message to an error queue
The time interval is configurable
Messages can be moved back to the original queue for replay using
ReturnToSourceQueue.exe tool.
21. A challenge – The Order ID
Old
New
The order ID has not been generated yet – it’s generated in the message
handler at the worker endpoint
22. Possible Solutions
Change the UI to not show the order ID
Use a GUID (Guid.NewGuid()) or find another way to generate the ID in the controller
instead of in the database
• message.OrderId = Guid.NewGuid();
Bus.Send(message);
ViewBag.OrderId = message.OrderId;
• 5773DD0E-0AB0-446B-8649-B2D43D7DA4AA is not a very user friendly ID
Move OrderRepository.Add(order) to the Controller:
• var orderId = OrderRepository.Add(order);
Bus.Send(message);
• Less reliable and more error prone solution
Use Send/Reply to simulate request/response
• The controller will wait for a PlaceOrderCompleted message that the PlaceOrder handler will send
• Too much overhead
• An Anti-pattern
23. We Still Have Poor Transaction Management
1. Add order
Handle PlaceOrder
Database
2. Charge credit card
PaymentService
3. Send mail
SMTP-Server
4. Deliver ebook
Exception
Error
DeviceService
Conseqence:
The credit card is charged (no transaction support)
A mail saying the order was successful was sent (no transaction support)
The order do not exist in the database (supports transaction – rolledback)
The message is put back on the queue and will be retried = credit card will be charged
twice
24. Solution
Split into man small messages - One message per transactional boundary
Place order
OrderController
Browser
1. Add PlaceOrder message
PlaceOrder message
2. Handle PlaceOrder
Add PayOrder message
If an error occur only
DeliverEbook is affected. The
message will be put back on the
queue and retried
SendMail message
4. Handle SendMail
DeliverEbook message
5. Handle DeliverEbook
PayOrder message
Queue
Add SendMail &
DeliverEbook message
3. Handle PayOrder
28. Yet another transactional issue
MSMQ
Processed
ok
Handle PayOrder message
Charge credit card
Request
Handle PayOrder
Request: Error
PaymentService
Payment OK
Network
error
External
Payment
Gateway
The message will be put back on the queue and processed again
Consequence: The credit card will be charged more than once
29. Solution
Operations should be idempotent
Idempotent operations can be run many times without changing the result
MSMQ
Handle PayOrder message
Charge credit card
Request
Handle PayOrder
Payment OK
PaymentService
Has the order
been paid?
Use OrderId
Database
Payment OK
External
Payment
Gateway
Has the
message
already been
processed?
Use order ID
or a GUID
Database
30. Another Challenge – Eventual Consistency
Users clicks on View
Order History
The PlaceOrder message is processed async by another process
If it has not gotten processed yet then the new order will not be in the list
Solution
Some UI trick?
Move the OrderRepository.Add to the controller
Make sure the messages are handled fast enough
• Define a SLA on the message to help monitoring
31. Publish/Subscribe
Place order
OrderController
Browser
1. Add PlaceOrder message
PlaceOrder command
2. Handle PlaceOrder
Add PayOrder command
With Publish/Subscribe the
Subscribers are loosely coupled
to the publisher
Subscribe to OrderWasPaid
4. Handle SendMail
Subscribes to OrderWasPaid
Queue
3. Handle PayOrder
Add OrderWasPaid event
OrderWasPaid
Subscribes to OrderWasPaid
4. Handle DeliverEbook
PayOrder command
OrderWasPaid
NServiceBus will add 2
messages to the
queue, one for each
subscriber
33. Scaling
Scale up
Easy to scale up if business processes are split into multiple messages
Increase the number of threads in the config – NServiceBus will concurrently process
multiple messages
Scale out
Use the Distributor or the Master (Both a distributor and a worker)
Worker #1
Message
MSMQ
Distributor
Worker #2
Worker #3
The distributor will forward the message to a worker that is ready to process the message
34. How the Distributor Works
1. Worker:
Send I’m ready
message
I’m ready message
Distributor:
Control Queue
I’m ready message
Distributor
Any messages in
the input queue?
PlaceOrder message
1. Website:
Send
PlaceOrder
message
Send PlaceOrder
message from input
queue
PlaceOrder message
Distributor
Input Queue
Yes
No
PlaceOrder message
Distributor
Find worker
through
message in
Storage
queue
Store I’m ready
message
Storage Queue
35. Other Features
Sagas
Long running workflow like processes
State is shared between multiple message handlers
Scheduling
Send a message every x minute. A handler will handle the message
Unobtrusive mode
Use your own ICommand, IEvent etc. to reduce coupling to NServiceBus
Supports
Various dependency injection containers
Logging frameworks
Etc.
++
36. NServiceBus License & Pricing
Open source
Used to be free, but not anymore
Indefinitely license with 1 year maintenance updates
• $500 USD per processing core
• $250 USD per sending core
Monthly subscription
• $35 USD per processing core
• $17 USD per sending core
Development and testing environments + disaster recovery and passive
backups are free
Developers need a license (free) that must be renewed every 3rd month
through particular.net