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

Event Sourcing,CQRS For PHP Application

Event Sourcing,CQRS For PHP Application

PHPアプリケーションでEvent Sourcing、CQRSを実践する場合の
ミドルウェアとの組み合わせ、基本的な考え方
実例を交えた資料です

yuuki takezawa

June 12, 2018
Tweet

More Decks by yuuki takezawa

Other Decks in Technology

Transcript

  1. Event Sourcing CQRS For PHP Application yuuki takezawa phpcon fuk

    2018
  2. ͸ͳ͢͜ͱ • Event • CQRS • Event Sourcing + CQRS

    • Event Sourcing / Message Broker • ࣮ྫ
  3. ͸ͳ͞ͳ͍͜ͱ • DDD • Lambda Architecture • Kappa Architecture •

    Apache Sparkʹ͍ͭͯ
  4. DDDͱҰॹʹड़΂ΒΕΔ͜ͱ͕ଟ͍Ͱ͕͢ɺ େن໛ͳσʔλॲཧͰ΋׆༻Ͱ͖Δύλʔϯ

  5. όονॲཧ͕ଟ͍ΞϓϦέʔγϣϯ΍ɺ ෳ਺ͷσʔλϕʔεؒͰ σʔλಉظΛ͢ΔΞϓϦέʔγϣϯʹ΋

  6. None
  7. Event / Application Side

  8. Event? • Observerύλʔϯ • ʙͨ࣌͠ʹɺʙ͢Δ Λදݱ͢Δ • PHPͷ༷ʑͳΞϓϦέʔγϣϯͰར༻͞Ε͍ͯΔ • \SplObserver,

    SplSubject
  9. Event / PHP • Symfony Event Dispatcher • Illuminate Events

    (Laravel) • Zend Event Manager • RxPHP • ReactPHP
  10. Event / PHP • γεςϜ౎߹ͰऔΓೖΕΔέʔε΋ଟ͍ • Request͕དྷͨΒɺRouteΛىಈͤ͞Δ • ʙͷॲཧ͕׬ྃͨ͠Βɺϩάʹॻ͖ग़͢

  11. public function __invoke( FulltextRequest $request ): RedirectResponse { // ొ࿥ॲཧޙʹevent

    try { $entity = new Entity(1, ‘testing’); $this->dispatcher->dispatch( new SinkConnect($this->usecase->run($entity)) ); } catch(\RuntimeException $e) { // Կ͔errorॲཧ } return $this->redirector->route('fulltext.index'); }
  12. Domain Event

  13. Event • υϝΠϯϞσϧ಺Ͱൃੜ͢Δग़དྷࣄ / υϝΠϯΠϕϯτ • ʙͨ࣌͠ʹɺʙ͢Δ Λදݱ͢Δ • υϝΠϯϞσϧΛލΔ΋ͷʹ஫໨͢Δ

    • ۀ຿తͳ؍఺͔ΒΠϕϯτͱͯ͠ѻ͏͔
 ܦաΛແࢹ͢΂͖͔Ͳ͏͔ͳͲ
  14. Domain Event + Observer in PHP

  15. ҰͭͷPHPΞϓϦέʔγϣϯͷ৔߹ • υϝΠϯϞσϧ಺ͷग़དྷࣄΛ
 ObserverΛ࢖࣮ͬͯ૷͢Δ • ΞϓϦέʔγϣϯͷΫϥε͕ංେԽͨ࣌͠
 খ͞ͳΫϥεʹ෼ׂ͢Δ৔߹΍ɺ
 ϦϑΝΫλϦϯάʹར༻͢Δ͜ͱ΋
 • ୯ҰͷΞϓϦέʔγϣϯ಺Ͱ࣮૷͢Δ৔߹ʹ༗༻


    (1ϓϩηεΏ͑)
  16. ߟྀ͢Δ͜ͱ • ϚΠΫϩαʔϏεͰ࿈ܞ͢Δ৔߹͸Ͳ͏͢΂͖͔ • ʙͨ࣌͠ʹɺʙ͢Δ
 ଞͷΞϓϦέʔγϣϯɾݴޠͰ࣮ߦ͞ΕΔ͔
 ੾Γग़͢ඞཁ͕͋Δ͔Ͳ͏͔

  17. ߟྀ͢Δ͜ͱ • ෳ਺ͷΞϓϦέʔγϣϯͱ࿈ܞͨ͠৔߹ͷো֐෮چ
 ϩάΛग़ྗ͍ͯ͠Δ͚ͩͰࡁΉ͔Ͳ͏͔ • ݁ՌΛσʔλϕʔεʹอଘ͠ɺ
 ΞϓϦέʔγϣϯͷσʔλͱͯ͠׆༻
 ݁ՌʹࢸΔ·Ͱͷաఔ͸ඞཁ͔Ͳ͏͔ • ཤྺσʔλอଘ͚ͩͰࡁΉ͔Ͳ͏͔

  18. ݎ͘ɺͦͯ͠ো֐ʹ΋ڧ͍ ΞϓϦέʔγϣϯʹ͠ͳ͚Ε͹ͳΒͳ͍

  19. Event Sourcing

  20. Event Sourcing • ΠϕϯτΛه࿥ͯ͠࠶ݱ͢Δύλʔϯ • ΠϕϯτΛΠϕϯτετΞʹอଘ • ه࿥͞ΕͨΠϕϯτ͔ΒΦϒδΣΫτΛ෮ݩͰ͖Δ • ΠϕϯτʴϩάʴΦϒδΣΫτɺΠϕϯτ͸ෆม

    • ൃੜͨ͠ࣄ࣮Λ఻͑Δ
  21. Event SourcingΛಋೖ͢΂͖Ͱ͸ͳ͍৔߹ • ΠϕϯτΛه࿥ͯ͠࠶ݱ͢Δඞཁ͕ͳ͍৔߹ • ه࿥͞ΕͨΠϕϯτ͔Β
 ΦϒδΣΫτΛ෮ݩ͢Δ͜ͱ͕ͳ͍৔߹ • খن໛ͳΞϓϦέʔγϣϯɺ
 γϯϓϧͳCRUD͔͠ͳ͍ΞϓϦέʔγϣϯ

    • ࢀরΑΓ΋ॻ͖ࠐΈ͕ϝΠϯͷΞϓϦέʔγϣϯ
  22. Event Sourcing • PHPͰͲ͏΍࣮ͬͯ૷͢Δ͔ʁ • RDBMSͱ૊Έ߹ΘͤͯશͯͷΠϕϯτ৘ใΛอ؅ʁ • େن໛ͳσʔλʹ͸ରԠͰ͖Δ͔ʁ • ר͖໭͠ͷॲཧ͸Ͳ͏͢Δ͔ʁ

  23. Asynchronous / Synchronous Event

  24. ಉظΠϕϯτ • Πϕϯτ͸ಉظॲཧͰ͋Δ΂͖͔Ͳ͏͔
 Πϕϯτൃੜ࣌ʹଈ࠲ʹଞΞϓϦέʔγϣϯʹ൓ө͢Δ ඞཁ͕͋Δ͔ • ΠϕϯτൃߦɺΠϕϯτཤྺอ࣋ɺ
 αϒεΫϥΠόʹΑΔσʔλӬଓԽΛߦ͏

  25. ඇಉظΠϕϯτ • Πϕϯτ͸ඇಉظʹͰ͖Δ͔Ͳ͏͔
 Πϕϯτ͕ൃੜͨ͜͠ͱΛ୲อ͠ɺ
 ଞΞϓϦέʔγϣϯ΁ͷ൓ө͸஗Ԇͤͯ͞΋Α͍͔ • ΠϕϯτൃߦɺΠϕϯτཤྺอ࣋·Ͱ
 σʔλӬଓԽ͸஗ԆͰ࣮ߦ͞ΕΔ
 (χΞϦΞϧλΠϜఔ౓)

  26. CQRS

  27. ΞϓϦέʔγϣϯͷ੒௕Ͱൃੜ͢Δ໰୊ • σʔλϞσϧͱύϑΥʔϚϯε • αʔϏε੒௕ͱڞʹ૿͑ΔෳࡶͳΫΤϦͱ૿͑Δ༰ྔ • σʔλͷਖ਼͠͞(ਖ਼نԽ)͔ޮ཰Խ͔(ඇਖ਼نԽ) • RDBMSͷෆಘҙ෼໺ +

    NoSQLʹΑΔΧόʔ
 ಉظํ๏ͷෳࡶԽ
  28. σʔλϕʔεઃܭͷ೰Έ • ਖ਼نԽͱநग़͍ͨ͠σʔλͷΪϟοϓ • நग़͍ͨ͠σʔλʹ߹ΘͤͨઃܭΛ͢Δ͜ͱʹΑΔ
 ੍໿͕͔͚ΒΕͳ͍δϨϯϚ • ࣮૷ίʔυͰ୲อ͢ΔͨΊʹෳࡶԽ • ಛఆͷσʔλϕʔεʹରͯ͠ͷCRUDʹґଘͨ͠ߟ͑

  29. ਖ਼نԽ͸͢΂͖ʂ

  30. ϏδωεཁٻʹରԠ͢ΔͨΊʹ
 σʔλϕʔεͰશͯରԠ͢Δͷ͸ਖ਼͍͔͠ ਖ਼نԽɺඇਖ਼نԽ͸
 ಉ࣠͡Ͱߟ͑Δ΂͖Ͱ͸ͳ͍

  31. Ϗδωεཁٻ γεςϜ౎߹(ϑϨʔϜϫʔΫͳͲ) Ϋϥεઃܭ γϯϓϧ͞ ύϑΥʔϚϯε

  32. CQRS "A few myths about CQRS". Ouarzy's Blog. 
 http://www.ouarzy.com/2016/10/02/a-few-myths-about-cqrs/

    ࢀর
  33. CQRSͱ͸Կ͔ • ॻ͖ࠐΈ(෭࡞༻͋Γ)ͱ
 ಡΈࠐΈ(෭࡞༻ͳ͠)Λ෼཭͢Δ • ෭࡞༻͋Γ͸σʔλͳͲʹԿΒ͔ͷมߋΛ༩͑Δ΋ͷ
 • ॻ͖ࠐΈ => Command


    • ಡΈࠐΈ => Query
  34. CQRS • ͋ΒΏΔϝιου͸ɺΞΫγϣϯΛ࣮ߦ͢ΔίϚϯυ ͔ɺݺͼग़͠ݩʹσʔλΛฦ͢ΫΤϦ͔ͷ͍ͣΕ͔Ͱ ͋ͬͯɺ྆ํΛߦͬͯ͸ͳΒͳ͍ɻ͜Ε͸ɺ࣭໰Λ͢Δ ͜ͱͰճ౴ΛมԽͤͯ͞͸ͳΒͳ͍ͱ͍͏͜ͱͩɻ
 
 "Greg YoungྲྀCQRS -

    Mark Nijhof". Digital Romanticism. 
 http://d.hatena.ne.jp/digitalsoul/20100712/1278886009 ࢀর 

  35. Command • ੔߹ੑ
 ੍໿Λ͔͚ͯਖ਼͘͠ɺݎ͘ • ॻ͖ࠐΈɺߋ৽ɺ࡟আॲཧ͸
 ಡΈࠐΈʹൺ΂ͯޮ཰ੑ΍଎౓ɺ
 εέʔϥϏϦςΟΛҙࣝ͢Δ͜ͱ͸͋·Γͳ͍

  36. Query • ੔߹ੑΑΓ΋ݕࡧޮ཰ • ΄ͱΜͲͷΞϓϦέʔγϣϯʹ͓͍ͯɺ
 ॻ͖ࠐΈΑΓ΋ݕࡧͷൺॏ͕େ͖͍͜ͱ͕΄ͱΜͲ • εέʔϧ͕༰қͰ͋Δ͜ͱɺ
 ߴ଎ͳύϑΥʔϚϯεͰ͋Δ͜ͱ

  37. PHPΞϓϦέʔγϣϯ޲͚
 Command, Query෼཭࣌ͷσʔλϕʔε

  38. Command

  39. Query

  40. Query

  41. Query

  42. Query

  43. Query

  44. Query

  45. CQRS Application Application

  46. ཧ۶͸Θ͔Δ͚Ͳɺ Ͳ͏࣮૷͢Ε͹͍͍ͷ͔ʁ ಉظ͸Ͳ͏͢Δͷʁ

  47. Event Sourcing + CQRS

  48. Event Sourcing / Command Event Application Command RDBMS

  49. Event Sourcing / Command Event Application Command RDBMS ΞϓϦέʔγϣϯ͔Β ॻ͖ࠐΈࢦࣔ(class)

  50. Event Sourcing / Command Event Application Command RDBMS ΞϓϦέʔγϣϯ͔Β ॻ͖ࠐΈࢦࣔ(class)

    σʔλϕʔεʹinsert
  51. Event Sourcing / Command Event Application Command RDBMS ΞϓϦέʔγϣϯ͔Β ॻ͖ࠐΈࢦࣔ(class)

    σʔλϕʔεʹinsert ਖ਼ৗʹॻ͖ࠐ·Εͨ ࣄ࣮Λฦ٫
  52. Event Sourcing / Command Event Application Command RDBMS ΞϓϦέʔγϣϯ͔Β ॻ͖ࠐΈࢦࣔ(class)

    σʔλϕʔεʹinsert ਖ਼ৗʹॻ͖ࠐ·Εͨ ࣄ࣮Λฦ٫ ࣄ࣮ʹج͍ͮͨ
 ΠϕϯτΛൃߦ
  53. Event Sourcing / Command Event Application Command RDBMS Transaction

  54. Event Sourcing / Query Event / Listener Application NoSQL Query

  55. Event Sourcing / Query Event / Listener Application NoSQL Query

    EventͷൃߦΛݕ஌͠ NoSQLʹσʔλΛૠೖ
  56. Event Sourcing / Queryྫ Event / Listener Application NoSQL Query

    EventͷൃߦΛݕ஌͠ NoSQLʹσʔλΛૠೖ Application͔ΒQuery
 நग़໰͍߹Θͤ
  57. Event Sourcing / Query Event / Listener Application NoSQL Query

    EventͷൃߦΛݕ஌͠ NoSQLʹσʔλΛૠೖ Application͔ΒQuery
 நग़໰͍߹Θͤ NoSQLʹ໰͍߹Θͤ υϝΠϯʹ࠷దԽ͞Εͨ΋ͷΛظ଴
  58. Event Sourcing / Query Event / Listener Application NoSQL Query

    EventͷൃߦΛݕ஌͠ NoSQLʹσʔλΛૠೖ Application͔ΒQuery
 நग़໰͍߹Θͤ NoSQLʹ໰͍߹Θͤ υϝΠϯʹ࠷దԽ͞Εͨ΋ͷΛظ଴ ݁ՌΛฦ͢ͷΈ
  59. Cache System σʔλϕʔεߋ৽
 $PNNBOE σʔλϕʔεߋ৽׬ྃΠϕϯτ
 &WFOU4PVSDJOH σʔλϕʔεߋ৽׬ྃݕ஌
 &WFOU-JTUFOFS Ωϟογϡ࡟আͳͲ

  60. Structure Event Publisher Command Query Event Subscriber

  61. Structure Event Publisher Command Query Event Subscriber ੹຿͸ॻ͖ࠐΈͷΈ

  62. Structure Event Publisher Command Query Event Subscriber ੹຿͸ॻ͖ࠐΈͷΈ ੹຿͸ಡΈࠐΈͷΈ

  63. Structure Event Publisher Command Query Event Subscriber ੹຿͸ॻ͖ࠐΈͷΈ ੹຿͸ಡΈࠐΈͷΈ ੹຿͸Eventૹ৴ͷΈ

  64. Structure Event Publisher Command Query Event Subscriber ੹຿͸ॻ͖ࠐΈͷΈ ੹຿͸ಡΈࠐΈͷΈ ੹຿͸Eventૹ৴ͷΈ

    ੹຿͸Eventड৴ͱ
 ॻ͖ࠐΈ
  65. Event Sourcing • CommandɺQueryɺEvent Sourcing͸
 ผΞϓϦέʔγϣϯɾݴޠͰ࣮૷Ͱ͖Δ͘Β͍ͷ
 γϯϓϧ͞ • EventอଘͱυϝΠϯʹରԠͨ͠QueryΛͲ͏΍ͬͯ
 ޮ཰తʹ࣮૷͢Δ͔

  66. ΞϓϦέʔγϣϯ෼ׂྫ

  67. ΞϓϦέʔγϣϯ෼ׂྫ PHP WebΞϓϦέʔγϣϯ webΞϓϦ։ൃνʔϜ

  68. ΞϓϦέʔγϣϯ෼ׂྫ PHP WebΞϓϦέʔγϣϯ webΞϓϦ։ൃνʔϜ ूܭॲཧ push etc CLI։ൃνʔϜ / DWH

    etc
  69. ΞϓϦέʔγϣϯ෼ׂྫ PHP WebΞϓϦέʔγϣϯ webΞϓϦ։ൃνʔϜ ूܭॲཧ push etc CLI։ൃνʔϜ / DWH

    etc ޿ࠂ഑৴ܥAPI ޿ࠂ഑৴։ൃνʔϜ
  70. ΞϓϦέʔγϣϯ෼ׂྫ PHP WebΞϓϦέʔγϣϯ webΞϓϦ։ൃνʔϜ ूܭॲཧ push etc CLI։ൃνʔϜ / DWH

    etc ޿ࠂ഑৴ܥAPI ޿ࠂ഑৴։ൃνʔϜ ϢʔβʔͷӾཡ৘ใʹج͍ͮͨ ৘ใ͕ཉ͍͠Ͱ͢ ϦΞϧλΠϜͰ
  71. Event Sourcing / Message Broker

  72. Event SourcingͱMiddlewareબఆ • PubSubͰشൃੑͷͳ͍΋ͷΛબ୒͢Δ • ϝοηʔδอ؅͕ՄೳͰɺ࠶ݱ͢Δ͜ͱ͕Մೳͳ΋ͷ Λ࠾༻͢Δͷ͕๬·͍͠ • εέʔϥϒϧͰ͋Δ͜ͱ

  73. Event Sourcing / RDBMS • PubSubͰشൃੑͷͳ͍΋ͷΛબ୒͢Δ
 ͦΜͳػೳ͸ͳ͍ͷͰόονॲཧͳͲͰ
 ఆظతʹσʔλ௥Ճ͕͋Δ͔Ͳ͏͔Λݕࡧ͢Δ
 • ϝοηʔδอ؅͕ՄೳͰɺ࠶ݱ͢Δ͜ͱ͕Մೳͳ΋ͷΛ࠾༻͢Δͷ

    ͕๬·͍͠
 ಘҙ෼໺ • εέʔϥϒϧͰ͋Δ͜ͱ
 SlaveͳͲΛ૿΍͢͜ͱͰରԠ͸Ͱ͖Δ
  74. Event Sourcing / Redis • PubSubͰشൃੑͷͳ͍΋ͷΛબ୒͢Δ
 PUBLISH SUBSCRIBEͳͲ͕͋ΔͷͰ࣮ݱ͸Ͱ͖Δ͕ɺ
 شൃੑʹ͍ͭͯ͸ઃఆͰؤுΔ
 •

    ϝοηʔδอ؅͕ՄೳͰɺ
 ࠶ݱ͢Δ͜ͱ͕Մೳͳ΋ͷΛ࠾༻͢Δͷ͕๬·͍͠
 ͋·ΓಘҙͰ͸ͳ͍(τϥϯβΫγϣϯͳ͠) • εέʔϥϒϧͰ͋Δ͜ͱ
 ༰қʹͰ͖Δ
  75. None
  76. Message Broker

  77. None
  78. Apache Kafka • ZookeeperΛར༻ͨ͠ΫϥελϦϯάʹΑΔߴՄ༻ੑ • ϝοηʔδͷӬଓԽɺϨϓϦέʔγϣϯɺ࠶औಘՄ • ϏοάσʔλରԠ • ετϦʔϜରԠͷϝοηʔδϯάϛυϧ΢ΣΞ

    • Kafka ConnectʹΑΔपลγεςϜͱͷߴ͍਌࿨ੑ
 (Amazon kinesisͱ΄΅ಉ͡)
  79. Event Sourcing • ΠϕϯτΛΠϕϯτετΞʹอଘ
 Kafkaࣗମʹอଘ͢Δ͜ͱ͕Ͱ͖ɺ
 σʔλϕʔεʹసૹՄೳ • ه࿥͞ΕͨΠϕϯτ͔ΒΦϒδΣΫτΛ෮ݩͰ͖Δ
 ॲཧ͞ΕͨΠϕϯτ͸࠶ൃߦՄೳ •

    ΠϕϯτʴϩάʴΦϒδΣΫτɺΠϕϯτ͸ෆม
 ൃߦޙͷΠϕϯτΛॻ͖׵͑Δ͜ͱ͸Ͱ͖ͳ͍ • ൃੜͨ͠ࣄ࣮Λ఻͑Δ
 τϥϯβΫγϣϯ͋Γ
  80. ϝοηʔδͷܽଛʹ͍ͭͯ ૹ৴ࣦഊ BDLड৴ࣦഊ #SPLFSμ΢ϯ ϝοηʔδड৴ࣦഊ

  81. ϝοηʔδ఻ୡͷอূ • At least once semantics
 ॏෳΛڐՄ • At most

    once semantics
 ܽଛΛڐՄ • Exactly once semantics
 ॏෳɺ͓ΑͼܽଛΛڐՄ͠ͳ͍
 
 "Exactly-once Semantics are Possible: Here’s How Kafka Does it". Confluent APACHE KAFKA. 
 https://www.confluent.io/blog/exactly-once-semantics-are-possible-heres-how-apache-kafka-does-it/ ࢀর
  82. Performance?

  83. Apache Kafka֓ཁ • Partition
 ෛՙ෼ࢄ༻్ʹར༻
 ෳ਺ͷConsumer͕ͦΕͧΕͷPartitionΛࢀর͠ɺ
 ͦΕͧΕ͕ॲཧΛߦ͏
 ॲཧϑϩʔͷσβΠϯʹΑͬͯଟ༷ͳར༻ํ๏ • librdkafka͕ඇৗʹߴ଎


    PHPͰ͸rdkafka(librdkafkaϥοϓ)
  84. Example Partition

  85. Performance • confluent: 250000 records, 34.84177593s • sarama-cluster: 250000 records,

    2m20.614963038s
 • confluent was almost 5x faster on the read.
  86. Consumer

  87. Kafka Connect • Kafka Connectͱ͸ɺ
 पลγεςϜ͔ΒͷσʔλΛऔΓࠐΈ(Source)ɺ
 σʔλૹ৴(Sink)ͷೋछྨΛαϙʔτ͢Δػೳ • Amazon SQS΍MongoDBͷσʔλΛKafkaͰऔࠐΉɺ


    ϝοηʔδΛͦͷ··Elasticsearch΍RDBMSʹ֨ೲɺ
 ͕ߦ͑Δ • Connect͸ࣗ༝ʹ֦ுͯ͠ಠࣗConnectΛ࣮૷Մೳ
  88. Kafka Connect • γϯϓϧͳέʔεͰ͋Ε͹ɺ
 ಛʹ࣮૷͢Δ͜ͱͳ͘QueryΛαϙʔτ • Consumer͸ผΞϓϦέʔγϣϯͱͯ͠
 ෼ׂ͢Δͷ΋͍͍Ͱ͠ΐ͏ • ෳࡶͳσʔλΛ࡞੒͢ΔͷͰ͋Ε͹


    ConsumerͰσʔλΛ૊Έ߹ΘͤΔ
  89. Structure Event Publisher Command Query Event Subscriber Application ੹຿͸ಡΈࠐΈͷΈ ੹຿͸Eventૹ৴ͷΈ

    WebΞϓϦέʔγϣϯ ͔Β੾Γग़͢
  90. Event Sourcing+ CQRS / Kafka • Command QueryΛ୲౰͢ΔWebΞϓϦέʔγϣϯΛ
 γϯϓϧʹ •

    Event SourcingʹΑͬͯɺΞϓϦέʔγϣϯʹՁ஋Λ௥ Ճ͢Δ͜ͱ͕Ͱ͖Δ(෼ੳͳͲ) • Command QueryͷಉظΛαϙʔτ͠ɺ
 ΞϓϦέʔγϣϯʹ߹Θͤͯෛՙ෼ࢄ͕༰қ
  91. ఆظߋ৽ͤ͞Δόονॲཧͷߟ͑ํ΋มΘΔ

  92. Example

  93. Example: Produce Ϣʔβʔͷ࣌ܥྻߦಈϩά͕ QIQSELBGLBܦ༝ͰૹΒΕͯ͘Δ

  94. Example: Kafka "QBDIF,BGLB  "QBDIF;PPLFFQFS  QBSUJUJPO ϲ݄͘Β͍Ͱԯ͘Β͍
 ΞϓϦέʔγϣϯ΁ͷো֐ɾऔΓ͜΅͠ͳ͠

  95. Example: Consume σʔλϕʔεΛ݁߹ͯ͠ϏδωεϩδοΫٵऩ QVTI௨஌ࢦࣔͳͲΠϕϯτΛૹ৴ ଞαʔϏε͕SBCCJUNRΛ࢖͍ͬͯΔͨΊ

  96. Example: Cassandra $BTTBOESB $MVTUFS ԯͪΐͬͱ͘Β͍ 55-͋ΓͷͨΊ  ো֐ͳ͠ɾίϯύΫγϣϯఆظ࣮ߦͰ τϥϒϧͳ͠

  97. Example: Cassandra ͜͜·Ͱ਺NTҎ಺Ͱऴྃ͢ΔͨΊɺ ΄΅ϦΞϧλΠϜͰ൓ө͞ΕΔ

  98. ଞ • ίϯςϯπͷσʔλΛKafkaܦ༝Ͱऩू͠HDFS֨ೲ
 SparkʹΑΔ෼ੳॲཧޙ Cassandra֨ೲ
 ΞϓϦέʔγϣϯ͔Β͸Cassandraʹ
 γϯϓϧͳΫΤϦΛ౤͛ΔͷΈʹ • Event Sourcing,

    CQRSͷ૊Έ߹ΘͤʹΑΓ
 Ωϟογϡੜ੒΍σʔλ࠷దԽʹΑΓߴ଎Խʹߩݙ

  99. Now

  100. େࡶ೺ͳαϯϓϧ͸ԼهΛࢀর͍ͩ͘͞
 https://github.com/ytake/laravel-presto- kafka-demo

  101. ·ͱΊ • େن໛ʹͳΔ͜ͱ͕༧ଌͰ͖ͨΒ
 ಋೖʹνϟϨϯδ • ҰͭͷϑϨʔϜϫʔΫ͚ͩͰ΍Ζ͏ͱ͠ͳ͍͜ͱ • ϛυϧ΢ΣΞͷ஌ࣝ͸ඞཁʹ • DDDͷ؍఺͚ͩͰ͸ͳ͘ɺ


    ෼ࢄॲཧ΍ෳࡶͳσʔλॲཧͷ
 ϦϑΝΫλϦϯάʹ΋׆͖Δύλʔϯ