Upgrade to Pro — share decks privately, control downloads, hide ads and more …

DevoxxFR 17' - CQRS/EventSourcing par la pratique

DevoxxFR 17' - CQRS/EventSourcing par la pratique

Clément HELIOU

April 07, 2017
Tweet

More Decks by Clément HELIOU

Other Decks in Programming

Transcript

  1. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr « Capturer tous les changements d’état

    d’une application comme une SÉQUENCE D’ÉVÈNEMENTS » Martin Fowler
  2. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr Date Débit Crédit 2016/05/14 100 €

    2016/05/14 -20 € 2016/05/16 -30 € 2016/05/24 380 € 2016/06/01 -70 € Total -120 € 480 € Solde 360 €
  3. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr APPLICATION Inspiré par J. Chassaing -

    http://thinkbeforecoding.com/post/2014/01/04/Event-Sourcing.-Draw-it Commande FONCTION DE
 DÉCISION
  4. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr APPLICATION Inspiré par J. Chassaing -

    http://thinkbeforecoding.com/post/2014/01/04/Event-Sourcing.-Draw-it FONCTION DE
 DÉCISION Commande FONCTION 
 D’ÉVOLUTION Évènement(s) EVENT STORE
  5. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr FONCTION D’ÉVOLUTION (état courant + évènement)

    => nouvel état Pour chaque évènement émis par 
 la fonction de décision
  6. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr APPLICATION Inspiré par J. Chassaing -

    http://thinkbeforecoding.com/post/2014/01/04/Event-Sourcing.-Draw-it Évènement(s) FONCTION DE
 DÉCISION Commande FONCTION 
 D’ÉVOLUTION EVENT STORE Action Effets de bord
  7. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr APPLICATION Inspiré par J. Chassaing -

    http://thinkbeforecoding.com/post/2014/01/04/Event-Sourcing.-Draw-it FONCTION DE
 DÉCISION RecevoirPrix
 {commande}
  8. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr APPLICATION Inspiré par J. Chassaing -

    http://thinkbeforecoding.com/post/2014/01/04/Event-Sourcing.-Draw-it FONCTION DE
 DÉCISION RecevoirPrix
 {commande} FONCTION 
 D’ÉVOLUTION PrixReçu
 {évènement}
  9. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr APPLICATION Inspiré par J. Chassaing -

    http://thinkbeforecoding.com/post/2014/01/04/Event-Sourcing.-Draw-it FONCTION DE
 DÉCISION RecevoirPrix
 {commande} FONCTION 
 D’ÉVOLUTION PrixReçu
 {évènement} Demande de prix Réception de prix PrixReçu
 {évènement} TransférerPrix
 {action} PrixTransféré
 {évènement}
  10. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr Bus Handler Handler EMS thread pool

    IUM thread pool EMS thread pool IUM thread pool Event loop Commandes Évènements Messages Messages
  11. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr Bus Handler Handler EMS thread pool

    IUM thread pool EMS thread pool IUM thread pool Event loop Commandes Évènements Messages Messages
  12. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr C2 = 10 ms C2 =

    10 + 10 ms C1 C2 C3 C1 = 10 ms C2 = 10 ms
  13. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr Bus Handler Handler EMS thread pool

    IUM thread pool EMS thread pool IUM thread pool Event loop Commandes Évènements Messages Messages
  14. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr BUS HANDLER HANDLER EMS thread pool

    IUM thread pool EMS thread pool IUM thread pool Event loop Commandes Évènements Messages Messages Event loop
  15. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr BUS HANDLER HANDLER EMS thread pool

    IUM thread pool EMS thread pool IUM thread pool Event loop Commandes Évènements Messages Messages Event loop Commandes
  16. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr APPLICATION Inspiré par J. Chassaing -

    http://thinkbeforecoding.com/post/2014/01/04/Event-Sourcing.-Draw-it Évènement(s) FONCTION DE
 DÉCISION Commande FONCTION 
 D’ÉVOLUTION EVENT STORE Action Effets de bord
  17. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr APPLICATION Inspiré par J. Chassaing -

    http://thinkbeforecoding.com/post/2014/01/04/Event-Sourcing.-Draw-it Évènement(s) FONCTION DE
 DÉCISION Commande FONCTION 
 D’ÉVOLUTION EVENT STORE Action Effets de bord
  18. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr Recevoir prix
 {commande} requêteId: 9387 prix:

    100€ FONCTION DE
 DÉCISION FONCTION DE
 DÉCISION Prix reçu
 {évènement} requêteId: 9387 prix: 100€ marge: 0,10€ Recevoir prix
 {commande} requêteId: 9387 prix: 100€ Prix reçu
 {évènement} requêteId: 9387 prix: 100€ marge: 0,20€ 12/02/2017 - Marge 0,1% 01/07/2017 - Marge 0,2%
  19. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr Dénommer un ÉVÈNEMENT n’est pas chose

    AISÉE. « Anatomy of domain event » M. Praglowski - http://blog.arkency.com/2016/05/the-anatomy-of-domain-event/
  20. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr Monitoring « MÉTIER » Contrôles basiques


    par client, produit, etc. Suivi temps-réel
 des transactions
  21. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr 
BUS D’ÉVÈNEMENTS MULTIPLUS HANDLER PUSH-API STOCKAGE

    AGRÉGATION INDEX Évènement Queue EMS Web Socket Vue CONSOLE Vue
  22. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr PUSH-API STOCKAGE AGRÉGATION INDEX Web Socket

    CONSOLE Évènement
 {transaction #345} Évènements
 {transaction #345} Vue
 {transaction #345} Vue
 {transaction #345}
  23. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr FONCTION 
 D’AGRÉGATION Exécution
 Demandée {transaction

    #345, idSéquence = 1} Exécution
 Acceptée {transaction #345, idSéquence = 2} FONCTION 
 D’AGRÉGATION Vue {transaction #345, 
 statut = TERMINÉE} Vue {transaction #345, 
 statut = EN COURS}
  24. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr FONCTION 
 D’AGRÉGATION Vue {transaction #345,

    
 statut = EN COURS} Exécution
 Acceptée {transaction #345, idSéquence = 2} FONCTION 
 D’AGRÉGATION Exécution
 Demandée {transaction #345, idSéquence = 1} Vue {transaction #345, 
 statut = TERMINÉE} FONCTION 
 D’AGRÉGATION Exécution
 Acceptée {transaction #345, idSéquence = 2} Vue {transaction #345, 
 statut = TERMINÉE}
  25. #DevoxxFR #XebiaDevoxx @c_heliou @XebiaFr RESSOURCES ๏XEBICON 15’ - CQRS +

    EVENT SOURCING: EN DIRECT ! ๏BACK DAY 15’ - EXPLORER LES PRINCIPES DE L’EVENT SOURCING ๏THINKBE4CODING #EVENTSOURCING ๏KATA MIXTER - https://github.com/devlyon/mixter - Kata explorant les principes de l’Event Sourcing/CQRS. - https://www.youtube.com/watch?v=QGGZs0KqxZw - Live coding présentant les principes de l’Event Sourcing/CQRS. - http://thinkbeforecoding.com/tag/Event%20Sourcing - L’un des auteurs français à suivre sur le sujet Event Sourcing/CQRS. - http://www.xebia.tv/vod?videoId=S8566fyZHp0 - Présentation plus large du projet Multiplus (DDD, BDD, Architecture hexagonale).