Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

SOA with NServiceBus 20130124

2,236 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

SOA with NServiceBus 20130124

  1. 1. SOAWith NServiceBus Sean Farmar
  2. 2. What is the problem we are trying to solve?• Scale• Growth• Stability and Durability
  3. 3. Why SOA?• SOAs tenets are about reducing coupling.
  4. 4. Why SOA? [cont.]• Coupling: • Afferent, efferent • Temporal • Spatial • Platform
  5. 5. n-tier architecture
  6. 6. In practice
  7. 7. In practice• Domain decomposition• Definition of components boundaries• Using messaging and pub/sub
  8. 8. Publish Subscribe [pub/sub]
  9. 9. Publish Subscribe [pub/sub]
  10. 10. 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
  11. 11. Why NServiceBus?• .Net Solution• Distributed bus (not a broker)• Messaging pub/sub (asynchronous)• Durable and Transactional (if you want)• Sagas
  12. 12. 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>();
  13. 13. 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); } }
  14. 14. Service Examples Place Order Sales Save status locally Save pricing locally Subscribe to Product PricingSubscribe to Customer Status Updated Updated Publish Product Pricing Updated Publish Customer Customer Status Updated Marketing Care Publish Order Accepted
  15. 15. 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>
  16. 16. Why NServiceBus? [cont.]• Integration• Scalable• Elegant programming model• Developer productivity• Used in the industry
  17. 17. A story aboutperformance
  18. 18. A story about performance• The evolution
  19. 19. A story about performance• Turning the lights on
  20. 20. A story about performance• Performance and Load testing• Fixing it• How did NServiceBus make it better?
  21. 21. Summary• SOA• NServiceBus• You can do it
  22. 22. Q&A
  23. 23. Thank You!nservicebus.comudidahan.com/blogSean Farmartwitter: @farmar

×