Advanced Messaging
Patterns
Donald Belcham
Long running processes
One process waits
on another process
Sometimes the system
is waiting for human
action
Sagas
Mechanism for
coordinating
multiple
processing
steps
Email
happy@face.com
Check email
Follow link
ilikedairyqueen.com/changepassword?id=<guid>
New password
___________
New Saga
ResetId = new GUID
AccountId = happy@face.com
Email
happy@face.com
Check email
Follow link
24hr limit
ilikedairyqueen.com/changepassword?id=<guid>
New password
___________
New Saga
ResetId = new GUID
AccountId = happy@face.com
RequestTimeout(24hrs)
Timeout Manager
Runs on a timer
Checks for expired timeouts
Saga Traits
- Model time
- Handle long “running”
business processes
- Coordinate workflow
- 2 or more steps required
(including the initial step)
Polymorphic
Dispatch
class ShipOrder : IUpdatePackaging
new ShipOrder()
IHandle<ShipOrder>
IHandle<IUpdatePackaging>
Composability
class CompleteOrder :
IUpdateSalesDashboard,
IUpdateSalesCommissions
class CancelOrder:
IUpdateSalesDashboard,
IUpdateSalesCommissions
Polymorphic Dispatch
- Elimination repetitive code
- Trigger parallel execution
paths
Message
Forwarding
Moving successfully
completed
messages to
additional endpoints
for more processing
new ShipOrder
(Priority = ShipPriority.Urgent)
ShipOrderPrioritizer :
IHandle<ShipOrder>
ShipUrgentOrders:
IHandle<ShipOrder>
ShipStandardOrders:
IHandle<ShipOrder>
ShipBackOrderedOrders:
IHandle<ShipOrder>
Auditing
Large Message
Payloads
Sometimes
messages need
to deal with
large data
class ProcessImage {
string Name { get; set; }
DateTime UploadDate { get; set; }
byte[ ] UploadedImage { get; set; }
}
Claim
Check
Pattern
class ProcessImage {
string Name { get; set; }
DateTime UploadDate { get; set; }
string ImagePath { get; set; }
}
Web Page Controller
Store to disk
IHandle<ProcessImage>
Store to disk
Sagas (stateful processes)
Polymorphic Dispatch
Message Forwarding
Large Messages
Multi-Level Retries
Circuit Breaker
Message Routing
Pub/Sub
Thank you
@dbelcham
donald.belcham@particular.net

Advanced messaging patterns