CQRS & Queue unlimited
Upcoming SlideShare
Loading in...5
×
 

CQRS & Queue unlimited

on

  • 1,848 views

 

Statistics

Views

Total Views
1,848
Views on SlideShare
1,848
Embed Views
0

Actions

Likes
0
Downloads
36
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

CQRS & Queue unlimited CQRS & Queue unlimited Presentation Transcript

  • ISKA 08/2010
    CQRS & QueueUnlimited
  • Introductionto CQRS pattern
    QueueUnlimited concepts andimplementation
    Demo
    What we are goingtosee
  • “Crack” for architects
    CQRS
  • Command
    Query
    Responsibility
    Segregation
    CQRS
  • CQRS – Why do we needit?
    FE Shop
    FE Administration
    BS Customer
    BS CRM
  • CQRS – Why do we needit?
    FE Shop
    FE Administration
    View
    Model
    Controller
    BS Customer
    BS CRM
    Service Layer
    DTO’s
    Services
    Domain (business logic)
    Data Access Layer
  • CQRS – Why do we needit?
    HTML
    View
    Model
    View Model
    Controller
    Service Layer
    SOAP / REST schema’s
    DTO’s
    Services
    Domain (business logic)
    Rows
    OO objects
    Data Access Layer
  • “How long wouldit take tocreate a screen likethis?”
    CQRS – WHY DO WE NEED IT?
  • In a traditional 3 layered SOA:
    Small changes = relative big impact
    Performance problems are very hard tosolve
    Mapping, mappingmapping Serialization, Serialization, …
    Authorizationhell
    Alllayers are coupled
    • (I knowyoudon’t want tohearthis, but is the truth !)
    CQRS – WHY DO WE NEED IT?
  • <asp:DataList ID="DataList1" runat="server" DataSourceID="LastUsersDataSource">
    <ItemTemplate>
    <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
    <br />
    </ItemTemplate>
    </asp:DataList>
    <asp:SqlDataSource ID="LastUsersDataSource" runat="server" ConnectionString="<%$ ConnectionStringsMyConnectionString%>"
    SelectCommand="SELECT [Name], [InsertDateTime] FROM [LastUsers] ORDER BY [InsertDateTime] DESC">
    </asp:SqlDataSource>
    MS demo’s rule !
  • Let’ssegregatequeriesandcommands
    Query:
    Query without transforming or mapping
    Show stale data whenever we can
    2 Tier
    Data store foreachview (persisted views)
    Command:
    Talk in business events
    Keep all events as a truth
    Tell, don’task
    Asyncwhenever we can
    3 Tier
    CQRS - to the rescue
  • CQRS - to the rescue
    UI
    UI DataStore
    Queries
    Subscribe
    EventBus
    Commands
    Business Logic
    Publish
    Truth (optional)
  • CQRS - to the rescue
    FE Shop
    FE Administration
    BS Customer
    BS CRM
    Events
  • Audit tracing
    Asyncby design
    Scalableby design
    Compensationable logic / conversations
    Close to the business
    Feature’s share no data/code = rapiddevelopment
    Best storage for best needs (ex: RDBMS forcommand processing, document basedfor UI datastore)
    Replayable
    Performance cannot get killedafteraddingthatone cool feature
    Rollout!
    Easy to unit test:
    Given <Previous Events>
    When <Command> is fired
    Then <New Events> expected
    CQRS - Advantages
  • Requiresalsoother view on specificationandtesting
     canbeconsideredan advantage 
    Release management has tobe different (per feature style)
     disadantagebecause of oldstyle program managers 
    Very hard toimplementcorrectly
    Needsmuch disc space 
    Eventuallyconsistencyseemsscarryto most IT managers
    CQRS - DISADvantages
  • QueueUnlimited
  • OpenSource project startedby Marc Rexwinkel en Tim Mahy
    http://queueunlimited.codeplex.com/
    For current customer platform:
    Sql Server 2008 R2
    Sql Server Service Broker
    .NET 3.5
    Queue Unlimited
  • A queue like data store that allows asynchronous processing
    A data store that can distribute it’s messages to multiple subscribers
    A data store that can perform a replay of it’s messages (from a certain period or all messages)
    A data store that can check retention lifetime of messages and remove them when necessary
    A data store that can optionally send all previous messages to a subscriber that is added a long time after an message was fired
    A data store that is manageable through default tooling (performance monitoring, intervening when production problems occur, backup …)
    A data store that can scale up or scale out
    A data store that can preserve the ordering of messages inside groups (functional partitioning)
    A data store that is fully ACID without a two phase commit (so no DTC)
    Queue Unlimited
  • UsesonlyStored Procedures
    Implementedusing SSB
    Queue Unlimited
  • How itworks
    Queue Unlimited – no subscribers
    PublishEvent SP
    InitiatorService
    Root Queue
    RootService
  • Queue Unlimited – Adding a subscriber
    PublishEvent SP
    InitiatorService
    Root Queue
    RootService
    Activated
    RootQueueActivation SP
    Replay 1 InitiatorService
    SubscriberInitiatorService
    Subscriber 1 Queue
    Replay 1 Queue
    Replay 1 ReceiveService
    SubscriberReceiveService
    Notactivated
    Generated SP
    Someapp
  • QUEUE UNLIMITED – Addinganothersubscriber
    SendEvent SP
    Initiator service
    Root Queue
    Receive Service
    Activated
    Distribute SP
    Initiator service 3
    Initiator service 2
    Subscriber 1 Queue
    Replay 1 Queue
    Receive Service 3
    Receive Service 2
    Activated
    Someapp
    Distribute 3 SP
    Initiator service 5
    Initiator service 4
    Subscriber 2 Queue
    Replay 2 Queue
    Receive Service 4
    Receive Service 5
    Notactivated
    Someapp
    Distribute 4 SP
  • QUEUE UNLIMITED – Garbagecollection
    SendEvent SP
    Initiator service
    Root Queue
    Receive Service
    Activated
    Distribute SP
    Initiator service 5
    Initiator service 2
    Initiator service 4
    Subscriber 1 Queue
    Replay 2 Queue
    Subscriber 2 Queue
    Receive Service 5
    Receive Service 2
    Receive Service 4
    Notactivated
    Distribute 4 SP
    Someapp
    Someapp
  • Open forsomefreshdevelopers
       
    Queue Unlimited
  • MultiplayerDice website
    Part of QueueUnlimitedforshowing demo possibilities
    For more demo’s look at:
    NCQRS (http://ncqrs.org/)
    CQRS4J (http://code.google.com/p/cqrs4j/)
    For more detailed information look at:
    http://skillsmatter.com/podcast/open-source-dot-net/udi-dahan-command-query-responsibility-segregation
    http://www.infoq.com/interviews/dahan-cqrs-ddd-nservicebus
    DEMO