ISKA 08/2010<br />CQRS & QueueUnlimited<br />
Introductionto CQRS pattern<br />QueueUnlimited concepts andimplementation<br />Demo<br />What we are goingtosee<br />
“Crack” for architects<br />CQRS<br />
Command<br />Query<br />Responsibility<br />Segregation<br />CQRS<br />
CQRS – Why do we needit?<br />FE Shop<br />FE Administration<br />BS Customer<br />BS CRM<br />
CQRS – Why do we needit?<br />FE Shop<br />FE Administration<br />View<br />Model<br />Controller<br />BS Customer<br />BS...
CQRS – Why do we needit?<br />HTML<br />View<br />Model<br />View Model<br />Controller<br />Service Layer<br />SOAP / RES...
“How long wouldit take tocreate a screen likethis?”<br />CQRS – WHY DO WE NEED IT?<br />
In a traditional 3 layered SOA:<br />Small changes = relative big impact<br />Performance problems are very hard tosolve<b...
<asp:DataList ID="DataList1" runat="server" DataSourceID="LastUsersDataSource"><br />    <ItemTemplate><br />        <asp:...
Let’ssegregatequeriesandcommands<br />Query:<br />Query without transforming or mapping<br />Show stale data whenever we c...
CQRS - to the rescue<br />UI<br />UI DataStore<br />Queries<br />Subscribe<br />EventBus<br />Commands<br />Business Logic...
CQRS - to the rescue<br />FE Shop<br />FE Administration<br />BS Customer<br />BS CRM<br />Events<br />
Audit tracing<br />Asyncby design<br />Scalableby design<br />Compensationable logic / conversations<br />Close to the bus...
Requiresalsoother view on specificationandtesting<br /> canbeconsideredan advantage <br />Release management has tobe di...
QueueUnlimited<br />
OpenSource project startedby Marc Rexwinkel en Tim Mahy<br />http://queueunlimited.codeplex.com/<br />For current customer...
A queue like data store that allows asynchronous processing<br />A data store that can distribute it’s messages to multipl...
UsesonlyStored Procedures<br />Implementedusing SSB<br />Queue Unlimited<br />
How itworks<br />Queue Unlimited – no subscribers<br />PublishEvent SP<br />InitiatorService<br />Root Queue<br />RootServ...
Queue Unlimited – Adding a subscriber<br />PublishEvent SP<br />InitiatorService<br />Root Queue<br />RootService<br />Act...
QUEUE UNLIMITED – Addinganothersubscriber<br />SendEvent SP<br />Initiator service<br />Root Queue<br />Receive Service<br...
QUEUE UNLIMITED – Garbagecollection<br />SendEvent SP<br />Initiator service<br />Root Queue<br />Receive Service<br />Act...
Open forsomefreshdevelopers<br />   <br />Queue Unlimited<br />
MultiplayerDice website<br />Part of QueueUnlimitedforshowing demo possibilities<br />For more demo’s look at:<br />NCQRS ...
Upcoming SlideShare
Loading in …5
×

CQRS & Queue unlimited

1,794 views

Published on

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

  • Be the first to like this

No Downloads
Views
Total views
1,794
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
40
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

CQRS & Queue unlimited

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

×