Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Event Sourcing,CQRS For PHP Application
Search
yuuki takezawa
June 12, 2018
Technology
1
4.5k
Event Sourcing,CQRS For PHP Application
PHPアプリケーションでEvent Sourcing、CQRSを実践する場合の
ミドルウェアとの組み合わせ、基本的な考え方
実例を交えた資料です
yuuki takezawa
June 12, 2018
Tweet
Share
More Decks by yuuki takezawa
See All by yuuki takezawa
PHPでアクターモデルを理解・体験しよう / Understand and experience the actor model in PHP
ytake
2
200
再考 アクターモデル/ reconsider actor model
ytake
0
620
GoとアクターモデルでES+CQRSを実践! / proto_actor_es_cqrs
ytake
1
320
Phluxorでアクターモデルを 理解・体験しよう / toolkit-for-flexible-actor-models-in-php-phluxor
ytake
1
230
オブジェクトのおしゃべり大失敗 メッセージングアンチパターン集 / messaging anti-pattern collection
ytake
2
1k
DRE/SREのプラクティス融合によるクラウドネイティブなデータ基盤作り / dre_sre
ytake
0
720
技術的負債と向き合う取り組みでよかったもの / positive_efforts_to_tackle_technical_debt
ytake
10
3.8k
アプリケーションエンジニアから強いデータエンジニアへの歩き方 / How to transition and become a Data Engineer from an Application Engineer
ytake
1
510
入門 境界づけられたコンテキスト
ytake
6
4.1k
Other Decks in Technology
See All in Technology
統計データで2024年の クラウド・インフラ動向を眺める
ysknsid25
2
810
実務につなげる数理最適化
recruitengineers
PRO
6
610
LINE Developersプロダクト(LIFF/LINE Login)におけるフロントエンド開発
lycorptech_jp
PRO
0
110
OpsJAWS32 re:Invent 2024 Ops系アップデートまとめ
takahirohori
0
200
IVRyエンジニア忘年LT大会2024 クリティカルユーザージャーニーの整理
abnoumaru
0
160
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
110
Ruby on Railsで作る銘柄スクリーニング
shoe116
0
120
継続的にアウトカムを生み出し ビジネスにつなげる、 戦略と運営に対するタイミーのQUEST(探求)
zigorou
0
370
データパイプラインをなんとかした話 / Improving the Data Pipeline in IVRy
mirakui
1
340
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
180
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
240
なぜCodeceptJSを選んだか
goataka
0
110
Featured
See All Featured
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
1
160
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
The Invisible Side of Design
smashingmag
298
50k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
How STYLIGHT went responsive
nonsquared
95
5.2k
Gamification - CAS2011
davidbonilla
80
5.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
Code Review Best Practice
trishagee
65
17k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Transcript
Event Sourcing CQRS For PHP Application yuuki takezawa phpcon fuk
2018
ͳ͢͜ͱ • Event • CQRS • Event Sourcing + CQRS
• Event Sourcing / Message Broker • ࣮ྫ
ͳ͞ͳ͍͜ͱ • DDD • Lambda Architecture • Kappa Architecture •
Apache Sparkʹ͍ͭͯ
DDDͱҰॹʹड़ΒΕΔ͜ͱ͕ଟ͍Ͱ͕͢ɺ େنͳσʔλॲཧͰ׆༻Ͱ͖Δύλʔϯ
όονॲཧ͕ଟ͍ΞϓϦέʔγϣϯɺ ෳͷσʔλϕʔεؒͰ σʔλಉظΛ͢ΔΞϓϦέʔγϣϯʹ
None
Event / Application Side
Event? • Observerύλʔϯ • ʙͨ࣌͠ʹɺʙ͢Δ Λදݱ͢Δ • PHPͷ༷ʑͳΞϓϦέʔγϣϯͰར༻͞Ε͍ͯΔ • \SplObserver,
SplSubject
Event / PHP • Symfony Event Dispatcher • Illuminate Events
(Laravel) • Zend Event Manager • RxPHP • ReactPHP
Event / PHP • γεςϜ߹ͰऔΓೖΕΔέʔεଟ͍ • Request͕དྷͨΒɺRouteΛىಈͤ͞Δ • ʙͷॲཧ͕ྃͨ͠Βɺϩάʹॻ͖ग़͢
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'); }
Domain Event
Event • υϝΠϯϞσϧͰൃੜ͢Δग़དྷࣄ / υϝΠϯΠϕϯτ • ʙͨ࣌͠ʹɺʙ͢Δ Λදݱ͢Δ • υϝΠϯϞσϧΛލΔͷʹ͢Δ
• ۀతͳ؍͔ΒΠϕϯτͱͯ͠ѻ͏͔ ܦաΛແࢹ͖͔͢Ͳ͏͔ͳͲ
Domain Event + Observer in PHP
ҰͭͷPHPΞϓϦέʔγϣϯͷ߹ • υϝΠϯϞσϧͷग़དྷࣄΛ ObserverΛ࣮ͬͯ͢Δ • ΞϓϦέʔγϣϯͷΫϥε͕ංେԽͨ࣌͠ খ͞ͳΫϥεʹׂ͢Δ߹ɺ ϦϑΝΫλϦϯάʹར༻͢Δ͜ͱ • ୯ҰͷΞϓϦέʔγϣϯͰ࣮͢Δ߹ʹ༗༻
(1ϓϩηεΏ͑)
ߟྀ͢Δ͜ͱ • ϚΠΫϩαʔϏεͰ࿈ܞ͢Δ߹Ͳ͏͖͔͢ • ʙͨ࣌͠ʹɺʙ͢Δ ଞͷΞϓϦέʔγϣϯɾݴޠͰ࣮ߦ͞ΕΔ͔ Γग़͢ඞཁ͕͋Δ͔Ͳ͏͔
ߟྀ͢Δ͜ͱ • ෳͷΞϓϦέʔγϣϯͱ࿈ܞͨ͠߹ͷো෮چ ϩάΛग़ྗ͍ͯ͠Δ͚ͩͰࡁΉ͔Ͳ͏͔ • ݁ՌΛσʔλϕʔεʹอଘ͠ɺ ΞϓϦέʔγϣϯͷσʔλͱͯ͠׆༻ ݁ՌʹࢸΔ·Ͱͷաఔඞཁ͔Ͳ͏͔ • ཤྺσʔλอଘ͚ͩͰࡁΉ͔Ͳ͏͔
ݎ͘ɺͦͯ͠োʹڧ͍ ΞϓϦέʔγϣϯʹ͠ͳ͚ΕͳΒͳ͍
Event Sourcing
Event Sourcing • ΠϕϯτΛهͯ͠࠶ݱ͢Δύλʔϯ • ΠϕϯτΛΠϕϯτετΞʹอଘ • ه͞ΕͨΠϕϯτ͔ΒΦϒδΣΫτΛ෮ݩͰ͖Δ • ΠϕϯτʴϩάʴΦϒδΣΫτɺΠϕϯτෆม
• ൃੜͨ͠ࣄ࣮Λ͑Δ
Event SourcingΛಋೖ͖͢Ͱͳ͍߹ • ΠϕϯτΛهͯ͠࠶ݱ͢Δඞཁ͕ͳ͍߹ • ه͞ΕͨΠϕϯτ͔Β ΦϒδΣΫτΛ෮ݩ͢Δ͜ͱ͕ͳ͍߹ • খنͳΞϓϦέʔγϣϯɺ γϯϓϧͳCRUD͔͠ͳ͍ΞϓϦέʔγϣϯ
• ࢀরΑΓॻ͖ࠐΈ͕ϝΠϯͷΞϓϦέʔγϣϯ
Event Sourcing • PHPͰͲ͏࣮ͬͯ͢Δ͔ʁ • RDBMSͱΈ߹ΘͤͯશͯͷΠϕϯτใΛอʁ • େنͳσʔλʹରԠͰ͖Δ͔ʁ • ר͖͠ͷॲཧͲ͏͢Δ͔ʁ
Asynchronous / Synchronous Event
ಉظΠϕϯτ • ΠϕϯτಉظॲཧͰ͋Δ͖͔Ͳ͏͔ Πϕϯτൃੜ࣌ʹଈ࠲ʹଞΞϓϦέʔγϣϯʹө͢Δ ඞཁ͕͋Δ͔ • ΠϕϯτൃߦɺΠϕϯτཤྺอ࣋ɺ αϒεΫϥΠόʹΑΔσʔλӬଓԽΛߦ͏
ඇಉظΠϕϯτ • ΠϕϯτඇಉظʹͰ͖Δ͔Ͳ͏͔ Πϕϯτ͕ൃੜͨ͜͠ͱΛ୲อ͠ɺ ଞΞϓϦέʔγϣϯͷөԆͤͯ͞Α͍͔ • ΠϕϯτൃߦɺΠϕϯτཤྺอ࣋·Ͱ σʔλӬଓԽԆͰ࣮ߦ͞ΕΔ (χΞϦΞϧλΠϜఔ)
CQRS
ΞϓϦέʔγϣϯͷͰൃੜ͢Δ • σʔλϞσϧͱύϑΥʔϚϯε • αʔϏεͱڞʹ૿͑ΔෳࡶͳΫΤϦͱ૿͑Δ༰ྔ • σʔλͷਖ਼͠͞(ਖ਼نԽ)͔ޮԽ͔(ඇਖ਼نԽ) • RDBMSͷෆಘҙ +
NoSQLʹΑΔΧόʔ ಉظํ๏ͷෳࡶԽ
σʔλϕʔεઃܭͷΈ • ਖ਼نԽͱநग़͍ͨ͠σʔλͷΪϟοϓ • நग़͍ͨ͠σʔλʹ߹ΘͤͨઃܭΛ͢Δ͜ͱʹΑΔ ੍͕͔͚ΒΕͳ͍δϨϯϚ • ࣮ίʔυͰ୲อ͢ΔͨΊʹෳࡶԽ • ಛఆͷσʔλϕʔεʹରͯ͠ͷCRUDʹґଘͨ͠ߟ͑
ਖ਼نԽ͖͢ʂ
ϏδωεཁٻʹରԠ͢ΔͨΊʹ σʔλϕʔεͰશͯରԠ͢Δͷਖ਼͍͔͠ ਖ਼نԽɺඇਖ਼نԽ ಉ࣠͡Ͱߟ͑Δ͖Ͱͳ͍
Ϗδωεཁٻ γεςϜ߹(ϑϨʔϜϫʔΫͳͲ) Ϋϥεઃܭ γϯϓϧ͞ ύϑΥʔϚϯε
CQRS "A few myths about CQRS". Ouarzy's Blog. http://www.ouarzy.com/2016/10/02/a-few-myths-about-cqrs/
ࢀর
CQRSͱԿ͔ • ॻ͖ࠐΈ(෭࡞༻͋Γ)ͱ ಡΈࠐΈ(෭࡞༻ͳ͠)Λ͢Δ • ෭࡞༻͋ΓσʔλͳͲʹԿΒ͔ͷมߋΛ༩͑Δͷ • ॻ͖ࠐΈ => Command
• ಡΈࠐΈ => Query
CQRS • ͋ΒΏΔϝιουɺΞΫγϣϯΛ࣮ߦ͢ΔίϚϯυ ͔ɺݺͼग़͠ݩʹσʔλΛฦ͢ΫΤϦ͔ͷ͍ͣΕ͔Ͱ ͋ͬͯɺ྆ํΛߦͬͯͳΒͳ͍ɻ͜Εɺ࣭Λ͢Δ ͜ͱͰճΛมԽͤͯ͞ͳΒͳ͍ͱ͍͏͜ͱͩɻ "Greg YoungྲྀCQRS -
Mark Nijhof". Digital Romanticism. http://d.hatena.ne.jp/digitalsoul/20100712/1278886009 ࢀর
Command • ߹ੑ ੍Λ͔͚ͯਖ਼͘͠ɺݎ͘ • ॻ͖ࠐΈɺߋ৽ɺআॲཧ ಡΈࠐΈʹൺͯޮੑɺ εέʔϥϏϦςΟΛҙࣝ͢Δ͜ͱ͋·Γͳ͍
Query • ߹ੑΑΓݕࡧޮ • ΄ͱΜͲͷΞϓϦέʔγϣϯʹ͓͍ͯɺ ॻ͖ࠐΈΑΓݕࡧͷൺॏ͕େ͖͍͜ͱ͕΄ͱΜͲ • εέʔϧ͕༰қͰ͋Δ͜ͱɺ ߴͳύϑΥʔϚϯεͰ͋Δ͜ͱ
PHPΞϓϦέʔγϣϯ͚ Command, Query࣌ͷσʔλϕʔε
Command
Query
Query
Query
Query
Query
Query
CQRS Application Application
ཧ۶Θ͔Δ͚Ͳɺ Ͳ͏࣮͢Ε͍͍ͷ͔ʁ ಉظͲ͏͢Δͷʁ
Event Sourcing + CQRS
Event Sourcing / Command Event Application Command RDBMS
Event Sourcing / Command Event Application Command RDBMS ΞϓϦέʔγϣϯ͔Β ॻ͖ࠐΈࢦࣔ(class)
Event Sourcing / Command Event Application Command RDBMS ΞϓϦέʔγϣϯ͔Β ॻ͖ࠐΈࢦࣔ(class)
σʔλϕʔεʹinsert
Event Sourcing / Command Event Application Command RDBMS ΞϓϦέʔγϣϯ͔Β ॻ͖ࠐΈࢦࣔ(class)
σʔλϕʔεʹinsert ਖ਼ৗʹॻ͖ࠐ·Εͨ ࣄ࣮Λฦ٫
Event Sourcing / Command Event Application Command RDBMS ΞϓϦέʔγϣϯ͔Β ॻ͖ࠐΈࢦࣔ(class)
σʔλϕʔεʹinsert ਖ਼ৗʹॻ͖ࠐ·Εͨ ࣄ࣮Λฦ٫ ࣄ࣮ʹج͍ͮͨ ΠϕϯτΛൃߦ
Event Sourcing / Command Event Application Command RDBMS Transaction
Event Sourcing / Query Event / Listener Application NoSQL Query
Event Sourcing / Query Event / Listener Application NoSQL Query
EventͷൃߦΛݕ͠ NoSQLʹσʔλΛૠೖ
Event Sourcing / Queryྫ Event / Listener Application NoSQL Query
EventͷൃߦΛݕ͠ NoSQLʹσʔλΛૠೖ Application͔ΒQuery நग़͍߹Θͤ
Event Sourcing / Query Event / Listener Application NoSQL Query
EventͷൃߦΛݕ͠ NoSQLʹσʔλΛૠೖ Application͔ΒQuery நग़͍߹Θͤ NoSQLʹ͍߹Θͤ υϝΠϯʹ࠷దԽ͞ΕͨͷΛظ
Event Sourcing / Query Event / Listener Application NoSQL Query
EventͷൃߦΛݕ͠ NoSQLʹσʔλΛૠೖ Application͔ΒQuery நग़͍߹Θͤ NoSQLʹ͍߹Θͤ υϝΠϯʹ࠷దԽ͞ΕͨͷΛظ ݁ՌΛฦ͢ͷΈ
Cache System σʔλϕʔεߋ৽ $PNNBOE σʔλϕʔεߋ৽ྃΠϕϯτ &WFOU4PVSDJOH σʔλϕʔεߋ৽ྃݕ &WFOU-JTUFOFS ΩϟογϡআͳͲ
Structure Event Publisher Command Query Event Subscriber
Structure Event Publisher Command Query Event Subscriber ॻ͖ࠐΈͷΈ
Structure Event Publisher Command Query Event Subscriber ॻ͖ࠐΈͷΈ ಡΈࠐΈͷΈ
Structure Event Publisher Command Query Event Subscriber ॻ͖ࠐΈͷΈ ಡΈࠐΈͷΈ Eventૹ৴ͷΈ
Structure Event Publisher Command Query Event Subscriber ॻ͖ࠐΈͷΈ ಡΈࠐΈͷΈ Eventૹ৴ͷΈ
Eventड৴ͱ ॻ͖ࠐΈ
Event Sourcing • CommandɺQueryɺEvent Sourcing ผΞϓϦέʔγϣϯɾݴޠͰ࣮Ͱ͖Δ͘Β͍ͷ γϯϓϧ͞ • EventอଘͱυϝΠϯʹରԠͨ͠QueryΛͲ͏ͬͯ ޮతʹ࣮͢Δ͔
ΞϓϦέʔγϣϯׂྫ
ΞϓϦέʔγϣϯׂྫ PHP WebΞϓϦέʔγϣϯ webΞϓϦ։ൃνʔϜ
ΞϓϦέʔγϣϯׂྫ PHP WebΞϓϦέʔγϣϯ webΞϓϦ։ൃνʔϜ ूܭॲཧ push etc CLI։ൃνʔϜ / DWH
etc
ΞϓϦέʔγϣϯׂྫ PHP WebΞϓϦέʔγϣϯ webΞϓϦ։ൃνʔϜ ूܭॲཧ push etc CLI։ൃνʔϜ / DWH
etc ࠂ৴ܥAPI ࠂ৴։ൃνʔϜ
ΞϓϦέʔγϣϯׂྫ PHP WebΞϓϦέʔγϣϯ webΞϓϦ։ൃνʔϜ ूܭॲཧ push etc CLI։ൃνʔϜ / DWH
etc ࠂ৴ܥAPI ࠂ৴։ൃνʔϜ ϢʔβʔͷӾཡใʹج͍ͮͨ ใ͕ཉ͍͠Ͱ͢ ϦΞϧλΠϜͰ
Event Sourcing / Message Broker
Event SourcingͱMiddlewareબఆ • PubSubͰشൃੑͷͳ͍ͷΛબ͢Δ • ϝοηʔδอ͕ՄೳͰɺ࠶ݱ͢Δ͜ͱ͕Մೳͳͷ Λ࠾༻͢Δͷ͕·͍͠ • εέʔϥϒϧͰ͋Δ͜ͱ
Event Sourcing / RDBMS • PubSubͰشൃੑͷͳ͍ͷΛબ͢Δ ͦΜͳػೳͳ͍ͷͰόονॲཧͳͲͰ ఆظతʹσʔλՃ͕͋Δ͔Ͳ͏͔Λݕࡧ͢Δ • ϝοηʔδอ͕ՄೳͰɺ࠶ݱ͢Δ͜ͱ͕ՄೳͳͷΛ࠾༻͢Δͷ
͕·͍͠ ಘҙ • εέʔϥϒϧͰ͋Δ͜ͱ SlaveͳͲΛ૿͢͜ͱͰରԠͰ͖Δ
Event Sourcing / Redis • PubSubͰشൃੑͷͳ͍ͷΛબ͢Δ PUBLISH SUBSCRIBEͳͲ͕͋ΔͷͰ࣮ݱͰ͖Δ͕ɺ شൃੑʹ͍ͭͯઃఆͰؤுΔ •
ϝοηʔδอ͕ՄೳͰɺ ࠶ݱ͢Δ͜ͱ͕ՄೳͳͷΛ࠾༻͢Δͷ͕·͍͠ ͋·ΓಘҙͰͳ͍(τϥϯβΫγϣϯͳ͠) • εέʔϥϒϧͰ͋Δ͜ͱ ༰қʹͰ͖Δ
None
Message Broker
None
Apache Kafka • ZookeeperΛར༻ͨ͠ΫϥελϦϯάʹΑΔߴՄ༻ੑ • ϝοηʔδͷӬଓԽɺϨϓϦέʔγϣϯɺ࠶औಘՄ • ϏοάσʔλରԠ • ετϦʔϜରԠͷϝοηʔδϯάϛυϧΣΞ
• Kafka ConnectʹΑΔपลγεςϜͱͷߴ͍ੑ (Amazon kinesisͱ΄΅ಉ͡)
Event Sourcing • ΠϕϯτΛΠϕϯτετΞʹอଘ Kafkaࣗମʹอଘ͢Δ͜ͱ͕Ͱ͖ɺ σʔλϕʔεʹసૹՄೳ • ه͞ΕͨΠϕϯτ͔ΒΦϒδΣΫτΛ෮ݩͰ͖Δ ॲཧ͞ΕͨΠϕϯτ࠶ൃߦՄೳ •
ΠϕϯτʴϩάʴΦϒδΣΫτɺΠϕϯτෆม ൃߦޙͷΠϕϯτΛॻ͖͑Δ͜ͱͰ͖ͳ͍ • ൃੜͨ͠ࣄ࣮Λ͑Δ τϥϯβΫγϣϯ͋Γ
ϝοηʔδͷܽଛʹ͍ͭͯ ૹ৴ࣦഊ BDLड৴ࣦഊ #SPLFSμϯ ϝοηʔδड৴ࣦഊ
ϝοηʔδୡͷอূ • 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/ ࢀর
Performance?
Apache Kafka֓ཁ • Partition ෛՙࢄ༻్ʹར༻ ෳͷConsumer͕ͦΕͧΕͷPartitionΛࢀর͠ɺ ͦΕͧΕ͕ॲཧΛߦ͏ ॲཧϑϩʔͷσβΠϯʹΑͬͯଟ༷ͳར༻ํ๏ • librdkafka͕ඇৗʹߴ
PHPͰrdkafka(librdkafkaϥοϓ)
Example Partition
Performance • confluent: 250000 records, 34.84177593s • sarama-cluster: 250000 records,
2m20.614963038s • confluent was almost 5x faster on the read.
Consumer
Kafka Connect • Kafka Connectͱɺ पลγεςϜ͔ΒͷσʔλΛऔΓࠐΈ(Source)ɺ σʔλૹ৴(Sink)ͷೋछྨΛαϙʔτ͢Δػೳ • Amazon SQSMongoDBͷσʔλΛKafkaͰऔࠐΉɺ
ϝοηʔδΛͦͷ··ElasticsearchRDBMSʹ֨ೲɺ ͕ߦ͑Δ • Connectࣗ༝ʹ֦ுͯ͠ಠࣗConnectΛ࣮Մೳ
Kafka Connect • γϯϓϧͳέʔεͰ͋Εɺ ಛʹ࣮͢Δ͜ͱͳ͘QueryΛαϙʔτ • ConsumerผΞϓϦέʔγϣϯͱͯ͠ ׂ͢Δͷ͍͍Ͱ͠ΐ͏ • ෳࡶͳσʔλΛ࡞͢ΔͷͰ͋Ε
ConsumerͰσʔλΛΈ߹ΘͤΔ
Structure Event Publisher Command Query Event Subscriber Application ಡΈࠐΈͷΈ Eventૹ৴ͷΈ
WebΞϓϦέʔγϣϯ ͔ΒΓग़͢
Event Sourcing+ CQRS / Kafka • Command QueryΛ୲͢ΔWebΞϓϦέʔγϣϯΛ γϯϓϧʹ •
Event SourcingʹΑͬͯɺΞϓϦέʔγϣϯʹՁΛ Ճ͢Δ͜ͱ͕Ͱ͖Δ(ੳͳͲ) • Command QueryͷಉظΛαϙʔτ͠ɺ ΞϓϦέʔγϣϯʹ߹Θͤͯෛՙࢄ͕༰қ
ఆظߋ৽ͤ͞Δόονॲཧͷߟ͑ํมΘΔ
ྫ
Example
Example: Produce Ϣʔβʔͷ࣌ܥྻߦಈϩά͕ QIQSELBGLBܦ༝ͰૹΒΕͯ͘Δ
Example: Kafka "QBDIF,BGLB "QBDIF;PPLFFQFS QBSUJUJPO ϲ݄͘Β͍Ͱԯ͘Β͍ ΞϓϦέʔγϣϯͷোɾऔΓ͜΅͠ͳ͠
Example: Consume σʔλϕʔεΛ݁߹ͯ͠ϏδωεϩδοΫٵऩ QVTI௨ࢦࣔͳͲΠϕϯτΛૹ৴ ଞαʔϏε͕SBCCJUNRΛ͍ͬͯΔͨΊ
Example: Cassandra $BTTBOESB $MVTUFS ԯͪΐͬͱ͘Β͍ 55-͋ΓͷͨΊ োͳ͠ɾίϯύΫγϣϯఆظ࣮ߦͰ τϥϒϧͳ͠
Example: Cassandra ͜͜·ͰNTҎͰऴྃ͢ΔͨΊɺ ΄΅ϦΞϧλΠϜͰө͞ΕΔ
ଞ • ίϯςϯπͷσʔλΛKafkaܦ༝Ͱऩू͠HDFS֨ೲ SparkʹΑΔੳॲཧޙ Cassandra֨ೲ ΞϓϦέʔγϣϯ͔ΒCassandraʹ γϯϓϧͳΫΤϦΛ͛ΔͷΈʹ • Event Sourcing,
CQRSͷΈ߹ΘͤʹΑΓ Ωϟογϡੜσʔλ࠷దԽʹΑΓߴԽʹߩݙ
Now
େࡶͳαϯϓϧԼهΛࢀর͍ͩ͘͞ https://github.com/ytake/laravel-presto- kafka-demo
·ͱΊ • େنʹͳΔ͜ͱ͕༧ଌͰ͖ͨΒ ಋೖʹνϟϨϯδ • ҰͭͷϑϨʔϜϫʔΫ͚ͩͰΖ͏ͱ͠ͳ͍͜ͱ • ϛυϧΣΞͷࣝඞཁʹ • DDDͷ؍͚ͩͰͳ͘ɺ
ࢄॲཧෳࡶͳσʔλॲཧͷ ϦϑΝΫλϦϯάʹ׆͖Δύλʔϯ