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.4k
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
GoとアクターモデルでES+CQRSを実践! / proto_actor_es_cqrs
ytake
1
210
Phluxorでアクターモデルを 理解・体験しよう / toolkit-for-flexible-actor-models-in-php-phluxor
ytake
1
150
オブジェクトのおしゃべり大失敗 メッセージングアンチパターン集 / messaging anti-pattern collection
ytake
2
900
DRE/SREのプラクティス融合によるクラウドネイティブなデータ基盤作り / dre_sre
ytake
0
620
技術的負債と向き合う取り組みでよかったもの / positive_efforts_to_tackle_technical_debt
ytake
10
3.7k
アプリケーションエンジニアから強いデータエンジニアへの歩き方 / How to transition and become a Data Engineer from an Application Engineer
ytake
1
420
入門 境界づけられたコンテキスト
ytake
6
4k
時間軸とドメインイベントとデータ処理
ytake
1
2.1k
事業のスケールアウトを支える PHPで作る分散アーキテクチャ
ytake
4
4.6k
Other Decks in Technology
See All in Technology
オンプレミス市監視村の人達と学ぶCloudWatch基礎
toru_kubota
1
290
チームで開発する際にアクセシビリティを保つ施策
azukiazusa1
5
1.4k
コンポーザブル関数についてVueUseを使って勉強しよう / 20240820_cloudsign_vuejs_lt
bengo4com
1
450
JavaScript 以外の言語によるフロントエンド Web 開発が既に実用段階である話
jsakamoto
0
1k
新たな顧客課題に挑む17年目の進化とモダナイゼーション / RAKUSTechCon2024_Haihaimail
rakus_dev
0
170
ダークテーマとアクセシビリティの融合したカラートークンの設計
degudegu2510
3
1.9k
付箋を使ったカラオケでワイワイしましょう/ Scrum Fest Sendai 2024 Karaoke
bonbon0605
0
110
ファインディでのGitHub Actions活用事例
puku0x
8
1.6k
(iOSDC Japan 2024) Concurrency Safe SwiftData - 並行安全なSwiftDataの使い方
teamhimeh
0
130
Jitoを使ったMEV Bot入門 / Super Tokyo - Tech Night
andooown
0
790
Gyazoの最近の生成AI関連の研究開発を全部見せます
yuiseki
0
110
Gitハンズオン準備
nomu
0
170
Featured
See All Featured
From Idea to $5000 a Month in 5 Months
shpigford
378
46k
Documentation Writing (for coders)
carmenintech
65
4.2k
StorybookのUI Testing Handbookを読んだ
zakiyama
24
5k
10 Git Anti Patterns You Should be Aware of
lemiorhan
652
58k
Build your cross-platform service in a week with App Engine
jlugia
227
18k
Designing Experiences People Love
moore
137
23k
Happy Clients
brianwarren
95
6.6k
GitHub's CSS Performance
jonrohan
1027
450k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
87
15k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.4k
How to name files
jennybc
74
97k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
33
1.7k
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ͷ؍͚ͩͰͳ͘ɺ
ࢄॲཧෳࡶͳσʔλॲཧͷ ϦϑΝΫλϦϯάʹ׆͖Δύλʔϯ