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.

CQRS con Windows Azure Service Bus y SignalR

1,545 views

Published on

En esta charla veremos las bases de una arquitectura CQRS así como su implementación utilizando Windows Azure Service Bus y SignalR.

Mediante la creación de una pequeña aplicación veremos los pasos para implementar esta arquitectura, así como sus beneficios a la hora de desarrollar aplicaciones donde es necesaria una gran escalabilidad.

Published in: Technology
  • Be the first to comment

CQRS con Windows Azure Service Bus y SignalR

  1. 1. CQRS USING WINDOWS AZURE SERVICE BUS
  2. 2. ¿Quiénes somos? Luis Ruiz Pavón @luisruizpavon Roberto González @robertogg
  3. 3. CQRS  CQRS = “Command Query Responsibility Segregation”  A design – pattern -architecture – Framework – Principle – Something 3
  4. 4. CQS Defined Bertrand Meyer (via Wikipedia) “Command Query Separation” ◦ “every method should either be a command that performs an action, or a query that returns data to the caller, but not both. In other words, asking a question should not change the answer.” 4
  5. 5. Benefits of CQRS  Isolated changes to the application  User Interface can change with zero impact to storage  Storage can be changed with zero impact to UI  Availability is very high, as all reads are unblocked
  6. 6. Queries  90%+ of access to our applications are READS from the datastore  Very Fast  Eventual Consistency  Cache It
  7. 7. Commands  Commands are directives to the domain to perform some action  Commands may be declined/rejected by the domain for various reasons  Processing a Command will result in 0:n Events raised  Commands are always in the imperative:  PlaceOrder, not OrderPlaced  Handler per command  Command can be queued  Split into separate queues
  8. 8. Demystifying Commands public class PlaceOrderCommand { //properties public readonly Guid OrderId; public readonly string Comment; //ctor public PlaceOrderCommand(Guid id, string comment) { OrderId = id; Comment = comment; } }
  9. 9. Events  Events are the result of some action having already happened in the Domain  Events may never be declined/rejected; they are evidence that something already happened  Events are always in the past-tense:  OrderPlaced, not PlaceOrder
  10. 10. Eventual Consistency  Property of a system such that not all records of state guaranteed to agree at any given point in time.  Applicable to whole systems or parts of systems (such as a database)  As opposed to Strongly Consistent (or Instantly Consistent)  Eventual Consistency is natural characteristic of a useful, scalable distributed systems
  11. 11. Why Eventual Consistency? CAP Theorem Consistency: all nodes see the same data at the same time Availability: a guarantee that every request receives a response about whether it was successful or failed) Partition tolerance: the system continues to operate despite arbitrary message loss From: http://en.wikipedia.org/wiki/CAP_theorem
  12. 12. CQRS in Windows Azure WE NEED:  Compute resource to run our code Web Roles (IIS) and Worker Roles (w/o IIS)  Reliable Queue to communicate Windows Azure Service Bus Queues  Durable/Persistent Storage SQL Azure  Fast View Azure Cache + NoSQL
  13. 13. Should I do CQRS? … “Probably Not” 
  14. 14. Links Udi Dahan: http://www.udidahan.com Greg Young: http://goodenoughsoftware.net/ CQRS Documents: http://cqrs.files.wordpress.com/2010/11/cqrs_documents.pdf

×