Upload
sean-farmar
View
1.818
Download
0
Embed Size (px)
DESCRIPTION
Citation preview
SOA With NServiceBus
Sean Farmar
What is the problem we are trying to
solve?
•Scale
•Growth
•Stability and Durability
Why SOA?
•SOA's tenets are about reducing coupling.
•Coupling:
•Afferent, efferent
•Temporal
•Spatial
•Platform
Why SOA? [cont.]
n-tier architecture
In practice
In practice
•Domain decomposition
•Definition of components boundaries
•Using messaging and pub/sub
Publish Subscribe [pub/sub]
Publish Subscribe [pub/sub]
In practice [cont.]
•Following principles (best thinking):
•Explicit intentions [naming, context]
•Single Responsibility
•Command Query Separation
•Drive your design and decision making to address all aspects of coupling
•Backwards compatibility
Why NServiceBus?
•.Net Solution
•Distributed bus (not a broker)
•Messaging pub/sub (asynchronous)
•Durable and Transactional (if you want)
•Sagas
Why NServiceBus? [cont.]
•A Message
[Serializable]public class EventMessage : IMyEvent{
public Guid EventId { get; set; }public DateTime? Time { get; set; }
}
public interface IMyEvent{
Guid EventId { get; set; }DateTime? Time { get; set; }TimeSpan Duration { get; set; }
}
var m = new EventMessage();// Or:var m = Bus.CreateInstance<IMyEvent>();
Why NServiceBus? [cont.]
•Handlerpublic IBus Bus { get; set; }
public class EventMessageHandler : IHandleMessages<EventMessage>{
public void Handle(EventMessage message){
// do stuff...IMyEvent anotherEventMessage;
anotherEventMessage = Bus.CreateInstance<IMyEvent>();
anotherEventMessage = Guid.NewGuid();
anotherEventMessage = DateTime.Now.Second;
anotherEventMessage = TimeSpan.FromSeconds(99999D);
Bus.Publish(anotherEventMessage);}
}
Service Examples
Subscribe to Customer Status Updated
Publish
Customer Status Updated
Save status locally
Subscribe to Product Product Pricing UpdatedPricing Updated
Publish
Product Pricing Updated
Save pricing locally
Place Order
Publish Order Accepted
Sales
Marketing
Customer Care
Why NServiceBus? [cont.]
•Config
<?xml version="1.0"?><configuration> <configSections> <section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core"/> <section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" /> </configSections>
<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>
<UnicastBusConfig ForwardReceivedMessagesTo="audit"> <MessageEndpointMappings> <add Messages="MyMessages" Endpoint="MyServer"/> </MessageEndpointMappings> </UnicastBusConfig> </configuration>
Why NServiceBus? [cont.]
•Integration
•Scalable
•Elegant programming model
•Developer productivity
•Used in the industry
A story about performance
A story about performance
•The evolution
A story about performance
•Turning the lights on
A story about performance
•Performance and Load testing
•Fixing it
•How did NServiceBus make it better?
Summary
•SOA
•NServiceBus
•You can do it
Q&A
Thank You!
nservicebus.comudidahan.com/blogSean Farmartwitter: @farmar