Event Driven Architecture

2,658 views
2,525 views

Published on

Presentation given at Saint Louis Day of .NET

0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,658
On SlideShare
0
From Embeds
0
Number of Embeds
23
Actions
Shares
0
Downloads
0
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide
  • Soft real time systems
  • Event Driven Architecture

    1. 1. EVENT DRIVEN ARCHITECTURE Chris Patterson Senior Architect, RelayHealth chris@phatboyg.com
    2. 2. EVENT DRIVEN ARCHITECTURE Chris Patterson Senior Architect, RelayHealth
    3. 3. Agenda Review Enterprise Application Integration Introduce Event Driven Architecture Define Events .NET sample using MassTransit
    4. 4. About Me Enterprise Software Architect 20+ years in commercial software development 11+ years at a Fortune 15 company Proven history with distributed, real-time systems Microsoft Visual C# MVP
    5. 5. ENTERPRISE APPLICATION INTEGRATION
    6. 6. ENTERPRISE APPLICATION INTEGRATION Linking applications in an organization together to simplify and automate business processes
    7. 7. Shared Database Multiple applications coupled to single schema Unclear ownership of schema Edges between applications blurred Linked servers for SQL to SQL RPC Changes often affect multiple applications
    8. 8. File Transfer Extract - Transform - Load (ETL) Asynchronous Simple interoperability through common formats Timeliness of data can lead to inconsistencies Large data volume containing unrelated data Ownership of files, cleanup, versioning
    9. 9. Web Services Explicit Contract (WSDL, DataContract) Synchronous Operation leads to sequencing Services must be available at invocation Nested call stacks fragile, consume resources Remote Procedure Call (RPC, COM, CORBA) The network is unreliable
    10. 10. MESSAGING
    11. 11. Message Exchange Create Process Send Receive
    12. 12. A-Synchronicity Message producers are non-blocking Fire and forget Message consumers run in their own process Introduces a more complex programming model
    13. 13. Minimized Coupling Eliminates temporal coupling Enables isolated testing of services Reduces dependencies, increasing service reuse
    14. 14. Explicit Contract Agreement between producer and consumer Internal data structure remains private Integration points remain at the application’s edge Eliminates propagation of internal changes
    15. 15. Fault Tolerance Messages improve recoverability Durable message transports
    16. 16. Data Availability Enables small, frequent transfers of related content Distribute system load over a wider time window
    17. 17. EVENT DRIVEN ARCHITECTURE
    18. 18. EVENT DRIVEN ARCHITECTURE A method of building enterprise systems in which events flow between decoupled components and services
    19. 19. Another Architecture? Service Oriented Event Driven Architecture Architecture
    20. 20. Service Oriented Event Driven Architecture Architecture Complimentary
    21. 21. Service Oriented Event Driven Architecture Architecture Complimentary
    22. 22. SOA 1.0 Applications are composed using a designer Synchronous programming model Step-by-step (F10) flow through services Majority of interactions are request/response
    23. 23. Event Driven Architecture Components are assembled at run-time Asynchronous programming model Reactive behavior Leverages one way, fire and forget, messaging
    24. 24. Autonomous Components Defined by responsibility Independent Self-governing - makes decisions on how to react Self-controlling - responsible for execution context Self-contained - not part of an application
    25. 25. Event Producers Publish events Oblivious to consumer reactions Unaffected by high number of consumers
    26. 26. Event Consumers React to events Subscribe by topic/type/selector Asynchronous operation
    27. 27. Business Components Logical grouping of autonomous components Represent a complete business process
    28. 28. COMMANDS
    29. 29. Commands Tell a component or service to do something Initiated by an event, interaction, etc. Use correlation for tracing, idempotence Sent using messaging (not published)
    30. 30. Reset Password User initiates a password reset Password service sends reset email User clicks link in email
    31. 31. Message Body public class ResetPassword { public Guid RequestId { get; set; } public string Username { get; set; } }
    32. 32. Compared To... public void ResetPassword(string username) public class ResetPassword { public Guid RequestId { get; set; } public string Username { get; set; } }
    33. 33. EVENTS
    34. 34. EVENTS Represent a change in state
    35. 35. Self Contained A pure and complete representation of a specific event Time relevant, not time sensitive Avoid references to internal data Reduces dependencies, loosens coupling
    36. 36. Identified Each event should have its own unique identifier
    37. 37. Related Related events should share a common identifier Allows event tracing (the new F11) Assists in combining events into processes
    38. 38. Observed Events are published as messages Multiple components can subscribe to the same event
    39. 39. EVENT TYPES
    40. 40. Business Events Map to real world events that occur in business Item Added to Cart Invoice Received Order Shipped Payment Requested
    41. 41. Lifecycle Events Notifications related to the life of a state or process Preparing Shipment / Shipment Prepared Authorizing Payment / Payment Authorization Complete Session Started / Session Completed
    42. 42. Management Events Relate events to time, ranges, limits Timely Service Guarantee Exceeded Your order within five minutes, or it’s free Popular Item Notification Items with a 5x increase in sales in an hour
    43. 43. MassTransit Key Points Lightweight Service Bus Implementation Loose coupling via publish/subscribe Active Service Pattern Supports MSMQ, ActiveMQ, TIBCO EMS Open Source, Apache 2.0 License
    44. 44. “EVENT DRIVEN ARCHITECTURE IS... programming without a call stack.” -Gregor Hohpe, Google
    45. 45. Testing Individual components testable in isolation Fully unit-testable using mocks and stubs Test-first development helps improve data contract
    46. 46. Logging Thorough logging with correlation information Log level configurable at runtime
    47. 47. Visualization Tools Present code-based logic in a visual form Aid in identifying composition problems Should be viewable on operational systems
    48. 48. FOR MORE INFORMATION
    49. 49. Reading Material
    50. 50. Reading Material
    51. 51. Reading Material
    52. 52. Reading Material
    53. 53. Reading Material
    54. 54. Reading Material
    55. 55. Reading Material
    56. 56. Web Sites MassTransit.GoogleCode.com Topshelf.GoogleCode.com Magnum.GoogleCode.com
    57. 57. CONTACT ME Chris@PhatBoyG.com http://PhatBoyG.LosTechies.com twitter: @PhatBoyG voice: text “cmp” to 50500

    ×