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.7k
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
なぜAI時代に 「イベント」を中心に考えるのか? / Why focus on "events" in the age of AI?
ytake
3
1.3k
PHPでアクターモデルを活用したSagaパターンの実践法 / php-saga-pattern-with-actor-model
ytake
0
1.8k
PHP ステートレス VS ステートフル 状態管理と並行性 / php-stateless-stateful
ytake
0
190
PHPでアクターモデルを理解・体験しよう / Understand and experience the actor model in PHP
ytake
2
660
再考 アクターモデル/ reconsider actor model
ytake
0
1.3k
GoとアクターモデルでES+CQRSを実践! / proto_actor_es_cqrs
ytake
1
540
Phluxorでアクターモデルを 理解・体験しよう / toolkit-for-flexible-actor-models-in-php-phluxor
ytake
1
320
オブジェクトのおしゃべり大失敗 メッセージングアンチパターン集 / messaging anti-pattern collection
ytake
2
1.2k
DRE/SREのプラクティス融合によるクラウドネイティブなデータ基盤作り / dre_sre
ytake
0
890
Other Decks in Technology
See All in Technology
トヨタ生産方式(TPS)入門
recruitengineers
PRO
3
270
浸透しなさいRFC 5322&7208
hinono
0
120
株式会社ARAV 採用案内
maqui
0
350
Evolution on AI Agent and Beyond - AGI への道のりと、シンギュラリティの3つのシナリオ
masayamoriofficial
0
190
Webアクセシビリティ入門
recruitengineers
PRO
1
300
7月のガバクラ利用料が高かったので調べてみた
techniczna
3
510
ZOZOTOWNフロントエンドにおけるディレクトリの分割戦略
zozotech
PRO
18
5.4k
広島銀行におけるAWS活用の取り組みについて
masakimori
0
140
Browser
recruitengineers
PRO
4
380
JuniorからSeniorまで: DevOpsエンジニアの成長ロードマップ
yuriemori
0
220
Understanding Go GC #coefl_go_jp
bengo4com
0
1.1k
開発と脆弱性と脆弱性診断についての話
su3158
1
1.1k
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
431
65k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4k
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
BBQ
matthewcrist
89
9.8k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
How GitHub (no longer) Works
holman
315
140k
Designing for humans not robots
tammielis
253
25k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
30
9.6k
Producing Creativity
orderedlist
PRO
347
40k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
570
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
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ͷ؍͚ͩͰͳ͘ɺ
ࢄॲཧෳࡶͳσʔλॲཧͷ ϦϑΝΫλϦϯάʹ׆͖Δύλʔϯ