leaving the monolith thanks to #eventsourcing @ #scpna
TRANSCRIPT
![Page 1: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/1.jpg)
Leaving The Monolith thanks to Event SourcingMigrations, Event Sourcing, AWS, and other things of the meter
@JavierCane#scpna - Software Craftsmanship Pamplona
![Page 2: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/2.jpg)
@JavierCane#scpna - Software Craftsmanship Pamplona
Saliendo del monolito, al Rico EventitoMigraciones, Event Sourcing, y otras cosas del meter
![Page 3: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/3.jpg)
Welcome!I’m Javier Ferrer González
@JavierCane
![Page 4: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/4.jpg)
Greetings to Sergi!@SergiGP
Welcome!
![Page 5: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/5.jpg)
Contents
! Starting point ! Needs ! Action plan ! Flow example ! Conclusions
![Page 6: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/6.jpg)
1. Starting point
Context
![Page 7: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/7.jpg)
![Page 8: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/8.jpg)
![Page 9: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/9.jpg)
![Page 10: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/10.jpg)
![Page 11: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/11.jpg)
Starting point Context
! Mobile first application ! Crazy growth (ads in TV in USA and Turkey)
◕ External services (Parse, Kahuna…)
◕ In-house API ! Where do we go
◕ Microservices architecture
◕ Event Sourcing
◕ Orchestration Layer
![Page 12: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/12.jpg)
2. Needs
New chat system!
![Page 13: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/13.jpg)
![Page 14: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/14.jpg)
Needs New chat system!
! From:
◕ REST API
◕ “Chat” (messaging system) ! To:
◕ WebSockets (better UX)
◕ Chat
◕ Isolated from API service
◕ Backwards Compatible (mobile!)
◕ Scale!
![Page 15: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/15.jpg)
3. Action plan
Maintaining Backwards Compatibility (BC)
![Page 16: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/16.jpg)
Action plan Maintaining BC
! Develop new chat with Scala and Akka, and WS ! Maintain BC taking advantage of Event Sourcing
![Page 17: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/17.jpg)
Action plan Maintaining BC
![Page 18: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/18.jpg)
Action plan Maintaining BC
![Page 19: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/19.jpg)
Action plan Maintaining BC
! Why not sync through DB?
◕ Share DB: K.A.O.S.
◕ Doesn’t scale
◕ Coupling
![Page 20: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/20.jpg)
Action plan Maintaining BC
![Page 21: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/21.jpg)
Action plan Maintaining BC
! Why not sync through SQS?
◕ Doesn’t scale
![Page 22: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/22.jpg)
Action plan Maintaining BC
![Page 23: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/23.jpg)
Action plan Maintaining BC
! Why?
◕ Scale
◕ Decoupled
◕ Open-Closed Principle compliant at a services level
![Page 24: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/24.jpg)
![Page 25: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/25.jpg)
![Page 26: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/26.jpg)
4. Flow example
Maintaining BC
![Page 27: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/27.jpg)
From the new chat to the legacy one
![Page 28: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/28.jpg)
Flow example Maintaining BC
![Page 29: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/29.jpg)
From the legacy chat to the new one
![Page 30: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/30.jpg)
Flow example Maintaining BC
![Page 31: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/31.jpg)
5. Conclusions
![Page 32: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/32.jpg)
Conclusions
! Event Sourcing ~~ DIP at a services level
◕ Dependency Inversion Principle (CodelyTV video)
◕ Allow OCP: One SNS publishes to many SQS
◕ Encourage SRP
◕ Decoupleeeeee
![Page 33: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/33.jpg)
Conclusions
![Page 34: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/34.jpg)
Conclusions
! Isolated services
◕ Different technologies
◕ Different context
◕ Change context => Mental challenge ! AWS vs RabbitMQ
◕ Go fast => AWS
! From PHP to Scala: 🙃 🙂 🙃 💃 🙃 😀 😐 😳 🤔 🙂 🙃 🙂 …
! Know more at #SCBCN16! (October 1st & 2nd in BCN)
![Page 35: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/35.jpg)
References / To take away
! A Series of Fortunate Events ! The anatomy of Domain Event ! 6 Code Smells with your CQRS Events and How to
Avoid Them ! json:api standard ! Sending Amazon SNS Messages to Amazon SQS
Queues ! Subscribing a Queue to an Amazon SNS Topic
![Page 37: Leaving The Monolith thanks to #EventSourcing @ #scpna](https://reader034.vdocuments.net/reader034/viewer/2022050614/5899d4b21a28ab4a0b8b5433/html5/thumbnails/37.jpg)
Credits
! Presentation base template by SlidesCarnival ! Graphics generated using draw.io