SlideShare ist ein Scribd-Unternehmen logo
1 von 43
Downloaden Sie, um offline zu lesen
TYPO3 Event Sourcing Oliver Hader 11/2016
Event Sourcing
… some new opportunities
November 5th, 2016
TYPO3 Event Sourcing Oliver Hader 11/2016
~basics
~bank account example

~generic modelling
~opportunities
TYPO3 Event Sourcing Oliver Hader 11/2016
DDD ~basics
TYPO3 Event Sourcing Oliver Hader 11/2016
Domain-driven Design
• book by Eric Evans, 2003
• robust & maintainable software applications
• domain experts & ubiquitous language
• toolbox for domain architectures
Layered Architecture
User Interface Layer
Application Layer
Domain Layer
Infrastructure Layer
Orchestrates application
and domain layer
Encapsulates domain
and data access
Encapsulates
infrastructure concerns
Aggregates
Customer
Address
Invoice
Car
Wheel
Engine
Garage
CarRental
Survey
car aggregate
customer aggregate
aggregate root
aggregate root
concerns
repairs
interviews
car rental aggregate
Bounded Contexts
Customer
Car
Fuel
CarRental
car rental bounded context
Car
Wheel
Engine
Garage
garage bounded context
Mechanic
Damage
~DomainModelCarRental ~DomainModelGarage
TYPO3 Event Sourcing Oliver Hader 11/2016
Entities & Value Objects
• make the implicit explicit
• make validation part of your domain model
• example for bank account number
• $account-­‐>setIban('CH1504842000000000002');	
  
• $iban	
  =	
  new	
  Iban('CH1504842000000000002');

$account-­‐>setIban($iban);
TYPO3 Event Sourcing Oliver Hader 11/2016
Events
• are messages
• are modelled in separate classes
• concerning something that really happened
• used to communicate between components
• handle with observer patterns (signal-slot)
• $event	
  =	
  new	
  ReplacedBrokenEngineEvent(…);
TYPO3 Event Sourcing Oliver Hader 11/2016
CQRS ~basics
TYPO3 Event Sourcing Oliver Hader 11/2016
CQS
• CQS - Command Query Separation
• actually defined by Bertrand Mayer in 1997
• separate processing in domain model into
• write model - modify state with command
• read model - fetch & represent state with query
TYPO3 Event Sourcing Oliver Hader 11/2016
CQRS
• CQRS - Command Query Responsibility Segregation
• more specific & restrictive by Greg Young
• segregation between write store & read store
• changes trigger updates in read store
• visualization just uses data-transfer objects
CQRS Overview
TYPO3 Event Sourcing Oliver Hader 11/2016
Event Sourcing ~basics
TYPO3 Event Sourcing Oliver Hader 11/2016
Event Sourcing
• … CQRS continued & in more details
• aim to persist events instead of resulting state
• event stores provide read/write capabilities
• applying all events results to current state again
• events are projected into desired formats
TYPO3 Event Sourcing Oliver Hader 11/2016
Events & Event Store
• events are immutable
• cannot be modified
• cannot be deleted
• legacy events must be handled
• event store is consistent
• events are retrieved in correct order
• there are no gaps in the event history
TYPO3 Event Sourcing Oliver Hader 11/2016
Projections
• are observers & handle events
• interpret and persist events to
• MySQL database
• filesystem, e.g. HTML
• emit notifications, mails
• whatever required format
TYPO3 Event Sourcing Oliver Hader 11/2016
Materialized View
• persist information for accordant requirements
• forget about complex JOIN statements
• data is represented denormalized
• pre-process information for view
• read 40 field values vs. just two are shown
Event Sourcing Overview
Command Handler
Command Bus
Repository
ServiceEventPublisher
EventHandler
Denormalizer
Thin Data Layer
Facade
Domain
DTOs
Commands
Aggregate
Events
Events
Events Events
SQL
ClientCommands Queries
External
Events
Internal
Events
some query
results
TYPO3 Event Sourcing Oliver Hader 11/2016
Why??? ~basics
TYPO3 Data Architecture
Repository &
Reconstitution
Routing
Controller
View
Model
Permission
Persistence
Infrastructure
Frontend Extbase Backend
EditDocumentController
FormEngine
<<TCA>>
FormDataProvider
BackendUserAuthentication
DataHandler
RelationHandler
TypoScriptFrontendController
ActionContoller
AbstractView
AbstractEntity & AbstractValueObject
Repository
Typo3DbBackend
Backend
PersistenceManager
DataMapper
StandaloneView <<custom>>
ConnectionPool
Connection
<<TCA>>
AbstractPlugin
ContentObjectRenderer
FrontendRequestHandler
BackendRouteDispatcher
BackendRequestHandler
MVCDispatcher
<<TypoScript>>
<<direct database operations>> <<direct database operations>>
x
x
x
Localization in TYPO3
DataHandlerController
DataHandler
RelationHandler
DatabaseConnection
translate
<<create>>
localize()
copyRecord()
<<create>>
DataHandler
process_datamap()
last_insert_id()
fetch record
record
[x]-processDBdata()
<<create>>
start()
fetch references
references
writeForeignField()
update references
insert record
new_record_id
new_record_id
new_record_id
references
new_record_id
multipleread&writeprocesses
Context & Overlays
is translation of
uid 13
sys_language_uid 0
:tt_content
l10n_parent 0
header Message
pid 100
t3ver_wsid 0
t3ver_state 0
t3ver_oid 0
uid 27
sys_language_uid 1
:tt_content
l10n_parent 13
header Nachricht
pid 100
t3ver_wsid 1
t3ver_state 1
t3ver_oid 0
uid 28
sys_language_uid 1
:tt_content
l10n_parent 13
header Nachricht
pid -1
t3ver_wsid 1
t3ver_state -1
t3ver_oid 27
uid 41
sys_language_uid 0
:tt_content
l10n_parent 0
header News
pid -1
t3ver_wsid 1
t3ver_state 0
t3ver_oid 13
is workspace
version of
is new
version
is default
version
is workspace
version of
is new
palceholder
TYPO3 Event Sourcing Oliver Hader 11/2016
Why…
• is persistence and relation handling different
• extbase cannot persist in workspace context
• only back-end has permission layer
• are context information persisted with each record
• are record overlays fetched & applied each time
TYPO3 Event Sourcing Oliver Hader 11/2016
bank account example
TYPO3 Event Sourcing Oliver Hader 11/2016
Regular approach
• using ExtensionBuilder to kick-start model
• AccountController - modify & read information
• AccountRepository - modify & read information
• Account modelled as aggregate root
• Transaction model bound to Aggregate (1:n)
• using lazy-loading for Transaction entities
TYPO3 Event Sourcing Oliver Hader 11/2016
Identify domain events
• event storming is a team process
• helps to combine knowledge concerning domain
• in style of reverse engineering
• working backwards
• identify events
• identify commands that lead to events
• identify rules that are applied to commands
… during T3DD16
Bank Account Example
debited
money
debit
money
account
not closed
balance
sufficient
account
created
deposit
money
account
not closed
deposited
money
create
account
TYPO3 Event Sourcing Oliver Hader 11/2016
Demo & Source Code
• https://github.com/TYPO3Incubator/
bank_account_example
• Configuration
• CommandController & ManagementController
• Domain Commands & Domain Events
• EventRepositories & ProjectionRepositories
• Projections & Data-Transfer Objects
TYPO3 Event Sourcing Oliver Hader 11/2016
generic modelling
TYPO3 Event Sourcing Oliver Hader 11/2016
Generic Domain Model
• no real models for most core database tables
• generic models contain common aspects
• identity (”tt_content:123”)
• atomic, direct values
• relations to other entities
• ”generic“ is not domain-driven
• but this concept is very useful here
TYPO3 Event Sourcing Oliver Hader 11/2016
Generic Domain Events
• created, modified, deleted ~CRUD (without R)
• moved, duplicated
• hidden, shown ~visibility
• translated ~language context
• branched, merged ~workspace context
• attached, removed, ordered relation ~association
TYPO3 Event Sourcing Oliver Hader 11/2016
Interceptors
• DataHandler ~$tce->process_datamap();
• DatabaseConnection ~INSERT, UPDATE, DELETE
• translate actions into generic commands
• $GLOBALS['TCA'][…]['ctrl']['eventSourcing']=[

	
  	
  	
  	
  'listenEvents'	
  =>	
  true,

	
  	
  	
  	
  'recordEvents'	
  =>	
  true,

	
  	
  	
  	
  'projectEvents'	
  =>	
  true,
TYPO3 Event Sourcing Oliver Hader 11/2016
Command Upgrades
• tranlate generic to specific domain commands
• delegates domain control back to application
• back to bank account example
• does not need to implement generic commands
• action in back-end form result in real commands
TYPO3 Event Sourcing Oliver Hader 11/2016
Context & Local Storage
• Materialized View on database-level
• workspace and language define specific context
• each context uses an individual database
• information stored in SQLite locally
• projections update for each context
• it was named Local Storage
Local Storage
DEFAULT
MySQL
- _conn: DriverConnection
Connection
+ select(...arguments[])
+ insert(…arguments[])
+ update(…arguments[])
+ delete(…arguments[])
ORIGIN
MySQL
- _conn: DriverConnection
Connection
+ select(...arguments[])
+ insert(…arguments[])
+ update(…arguments[])
+ delete(…arguments[])
DefaultConnection
LocalStorage
workspace-0
SQLite
- _conn: DriverConnection
Connection
+ select(...arguments[])
+ insert(…arguments[])
+ update(…arguments[])
+ delete(…arguments[])
DefaultConnection
LocalStorage
workspace-1
SQLite
- _conn: DriverConnection
Connection
+ select(...arguments[])
+ insert(…arguments[])
+ update(…arguments[])
+ delete(…arguments[])
current state future state, context based
assigned
to
assigned to
TYPO3 Event Sourcing Oliver Hader 11/2016
Demo & Source Code
• https://github.com/TYPO3Incubator/data_handling
• Content Editing in back-end
• Event Store results
• Projections
• Command Translations
TYPO3 Event Sourcing Oliver Hader 11/2016
opportunities
TYPO3 Event Sourcing Oliver Hader 11/2016
Projections!
• separation between mutation & presentation
• events are the new & only true source
• everything else can be projected
• … and re-projected if it was wrong
• e.g. https://review.typo3.org/#/c/45320/
• trigger index update (Solr, Elasticsearc)
TYPO3 Event Sourcing Oliver Hader 11/2016
Questions?
TYPO3 Event Sourcing Oliver Hader 11/2016
Sources
• Figures
• “Layered Architecture“ - Buenosvinos, Carlos, Soronellas, Christian und Akbary, Keyvan. 2016. Domain-
Driven Design in PHP. Victoria : Leanpub, 2016. ISBN 9780994608413
• ”CQRS Overview“ - Betts, Dominic, et al. 2013. Exploring CQRS and Event Sourcing. Redmond : Microsoft
patterns & practices, 2013. ISBN 9781621140160
• ”Event Sourcing Overview“ - Nijhof, Mark. 2013. CQRS, The example. Victoria : Leanpub, 2013. ISBN
9781484102879
• GitHub source codes
• https://github.com/TYPO3Incubator/bank_account_example
• https://github.com/TYPO3Incubator/data_handling
• Master Thesis on Event Sourcing (German only)
• https://get.h4ck3r31.net/T3CRR16-HwWL498EvURCxnnittPoHyNrXkN3xi/
Hader_Oliver_TYPO3_EventSourcing.pdf
TYPO3 Event Sourcing Oliver Hader 11/2016
Thank you!
ohader

@ohader

Oliver_Hader
follow mehttps://h4ck3r31.net

Más contenido relacionado

Was ist angesagt?

There’s an OpenBullet Attack Config for Your Site – What Should You Do?
There’s an OpenBullet Attack Config for Your Site – What Should You Do?There’s an OpenBullet Attack Config for Your Site – What Should You Do?
There’s an OpenBullet Attack Config for Your Site – What Should You Do?DevOps.com
 
Defeating firefox by Muneaki Nishimunea - CODE BLUE 2015
Defeating firefox by Muneaki Nishimunea - CODE BLUE 2015Defeating firefox by Muneaki Nishimunea - CODE BLUE 2015
Defeating firefox by Muneaki Nishimunea - CODE BLUE 2015CODE BLUE
 
Abusing Adobe Reader’s JavaScript APIs by Abdul-Aziz Hariri & Brian Gorenc - ...
Abusing Adobe Reader’s JavaScript APIs by Abdul-Aziz Hariri & Brian Gorenc - ...Abusing Adobe Reader’s JavaScript APIs by Abdul-Aziz Hariri & Brian Gorenc - ...
Abusing Adobe Reader’s JavaScript APIs by Abdul-Aziz Hariri & Brian Gorenc - ...CODE BLUE
 
SANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection ExploitedSANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection ExploitedMicah Hoffman
 
CMS Hacking Tricks - DerbyCon 4 - 2014
CMS Hacking Tricks - DerbyCon 4 - 2014CMS Hacking Tricks - DerbyCon 4 - 2014
CMS Hacking Tricks - DerbyCon 4 - 2014Greg Foss
 
[CB16] Invoke-Obfuscation: PowerShell obFUsk8tion Techniques & How To (Try To...
[CB16] Invoke-Obfuscation: PowerShell obFUsk8tion Techniques & How To (Try To...[CB16] Invoke-Obfuscation: PowerShell obFUsk8tion Techniques & How To (Try To...
[CB16] Invoke-Obfuscation: PowerShell obFUsk8tion Techniques & How To (Try To...CODE BLUE
 
Offensive Python for Pentesting
Offensive Python for PentestingOffensive Python for Pentesting
Offensive Python for PentestingMike Felch
 
Cloud security best practices in AWS by: Ankit Giri
Cloud security best practices in AWS by: Ankit GiriCloud security best practices in AWS by: Ankit Giri
Cloud security best practices in AWS by: Ankit GiriOWASP Delhi
 
BSIDES-PR Keynote Hunting for Bad Guys
BSIDES-PR Keynote Hunting for Bad GuysBSIDES-PR Keynote Hunting for Bad Guys
BSIDES-PR Keynote Hunting for Bad GuysJoff Thyer
 
Web security for developers
Web security for developersWeb security for developers
Web security for developersSunny Neo
 
Introduction to red team operations
Introduction to red team operationsIntroduction to red team operations
Introduction to red team operationsSunny Neo
 
SignaturesAreDead Long Live RESILIENT Signatures
SignaturesAreDead Long Live RESILIENT SignaturesSignaturesAreDead Long Live RESILIENT Signatures
SignaturesAreDead Long Live RESILIENT SignaturesDaniel Bohannon
 
Lares from LOW to PWNED
Lares from LOW to PWNEDLares from LOW to PWNED
Lares from LOW to PWNEDChris Gates
 
Pwning the Enterprise With PowerShell
Pwning the Enterprise With PowerShellPwning the Enterprise With PowerShell
Pwning the Enterprise With PowerShellBeau Bullock
 
Zentral presentation MacAdmins meetup Univ. Utah
Zentral presentation MacAdmins meetup Univ. Utah Zentral presentation MacAdmins meetup Univ. Utah
Zentral presentation MacAdmins meetup Univ. Utah Henry Stamerjohann
 
Red Team vs Blue Team on AWS - RSA 2018
Red Team vs Blue Team on AWS - RSA 2018Red Team vs Blue Team on AWS - RSA 2018
Red Team vs Blue Team on AWS - RSA 2018Teri Radichel
 

Was ist angesagt? (20)

Zap vs burp
Zap vs burpZap vs burp
Zap vs burp
 
There’s an OpenBullet Attack Config for Your Site – What Should You Do?
There’s an OpenBullet Attack Config for Your Site – What Should You Do?There’s an OpenBullet Attack Config for Your Site – What Should You Do?
There’s an OpenBullet Attack Config for Your Site – What Should You Do?
 
Defeating firefox by Muneaki Nishimunea - CODE BLUE 2015
Defeating firefox by Muneaki Nishimunea - CODE BLUE 2015Defeating firefox by Muneaki Nishimunea - CODE BLUE 2015
Defeating firefox by Muneaki Nishimunea - CODE BLUE 2015
 
Abusing Adobe Reader’s JavaScript APIs by Abdul-Aziz Hariri & Brian Gorenc - ...
Abusing Adobe Reader’s JavaScript APIs by Abdul-Aziz Hariri & Brian Gorenc - ...Abusing Adobe Reader’s JavaScript APIs by Abdul-Aziz Hariri & Brian Gorenc - ...
Abusing Adobe Reader’s JavaScript APIs by Abdul-Aziz Hariri & Brian Gorenc - ...
 
SANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection ExploitedSANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection Exploited
 
CMS Hacking Tricks - DerbyCon 4 - 2014
CMS Hacking Tricks - DerbyCon 4 - 2014CMS Hacking Tricks - DerbyCon 4 - 2014
CMS Hacking Tricks - DerbyCon 4 - 2014
 
Eyeing the Onion
Eyeing the OnionEyeing the Onion
Eyeing the Onion
 
[CB16] Invoke-Obfuscation: PowerShell obFUsk8tion Techniques & How To (Try To...
[CB16] Invoke-Obfuscation: PowerShell obFUsk8tion Techniques & How To (Try To...[CB16] Invoke-Obfuscation: PowerShell obFUsk8tion Techniques & How To (Try To...
[CB16] Invoke-Obfuscation: PowerShell obFUsk8tion Techniques & How To (Try To...
 
Offensive Python for Pentesting
Offensive Python for PentestingOffensive Python for Pentesting
Offensive Python for Pentesting
 
Cloud security best practices in AWS by: Ankit Giri
Cloud security best practices in AWS by: Ankit GiriCloud security best practices in AWS by: Ankit Giri
Cloud security best practices in AWS by: Ankit Giri
 
Zentral macaduk conf 2016
Zentral macaduk conf 2016Zentral macaduk conf 2016
Zentral macaduk conf 2016
 
BSIDES-PR Keynote Hunting for Bad Guys
BSIDES-PR Keynote Hunting for Bad GuysBSIDES-PR Keynote Hunting for Bad Guys
BSIDES-PR Keynote Hunting for Bad Guys
 
Web security for developers
Web security for developersWeb security for developers
Web security for developers
 
Introduction to red team operations
Introduction to red team operationsIntroduction to red team operations
Introduction to red team operations
 
Zentral london mac_ad_uk_2017
Zentral london mac_ad_uk_2017Zentral london mac_ad_uk_2017
Zentral london mac_ad_uk_2017
 
SignaturesAreDead Long Live RESILIENT Signatures
SignaturesAreDead Long Live RESILIENT SignaturesSignaturesAreDead Long Live RESILIENT Signatures
SignaturesAreDead Long Live RESILIENT Signatures
 
Lares from LOW to PWNED
Lares from LOW to PWNEDLares from LOW to PWNED
Lares from LOW to PWNED
 
Pwning the Enterprise With PowerShell
Pwning the Enterprise With PowerShellPwning the Enterprise With PowerShell
Pwning the Enterprise With PowerShell
 
Zentral presentation MacAdmins meetup Univ. Utah
Zentral presentation MacAdmins meetup Univ. Utah Zentral presentation MacAdmins meetup Univ. Utah
Zentral presentation MacAdmins meetup Univ. Utah
 
Red Team vs Blue Team on AWS - RSA 2018
Red Team vs Blue Team on AWS - RSA 2018Red Team vs Blue Team on AWS - RSA 2018
Red Team vs Blue Team on AWS - RSA 2018
 

Ähnlich wie TYPO3 Event Sourcing

Growing into a proactive Data Platform
Growing into a proactive Data PlatformGrowing into a proactive Data Platform
Growing into a proactive Data PlatformLivePerson
 
Using Event Streams in Serverless Applications
Using Event Streams in Serverless ApplicationsUsing Event Streams in Serverless Applications
Using Event Streams in Serverless ApplicationsJonathan Dee
 
Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...
Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...
Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...confluent
 
Hadoop Summit 2014: Processing Complex Workflows in Advertising Using Hadoop
Hadoop Summit 2014: Processing Complex Workflows in Advertising Using HadoopHadoop Summit 2014: Processing Complex Workflows in Advertising Using Hadoop
Hadoop Summit 2014: Processing Complex Workflows in Advertising Using HadoopBernardo de Seabra
 
Processing Complex Workflows in Advertising using Hadoop
Processing Complex Workflows in Advertising using HadoopProcessing Complex Workflows in Advertising using Hadoop
Processing Complex Workflows in Advertising using HadoopDataWorks Summit
 
The Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersThe Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersSATOSHI TAGOMORI
 
Data Con LA 2018 - Enabling real-time exploration and analytics at scale at H...
Data Con LA 2018 - Enabling real-time exploration and analytics at scale at H...Data Con LA 2018 - Enabling real-time exploration and analytics at scale at H...
Data Con LA 2018 - Enabling real-time exploration and analytics at scale at H...Data Con LA
 
Realtime Analytics on AWS
Realtime Analytics on AWSRealtime Analytics on AWS
Realtime Analytics on AWSSungmin Kim
 
data-mesh-101.pptx
data-mesh-101.pptxdata-mesh-101.pptx
data-mesh-101.pptxTarekHamdi8
 
The Great Lakes: How to Approach a Big Data Implementation
The Great Lakes: How to Approach a Big Data ImplementationThe Great Lakes: How to Approach a Big Data Implementation
The Great Lakes: How to Approach a Big Data ImplementationInside Analysis
 
Events and microservices
Events and microservicesEvents and microservices
Events and microservicesSaul Caganoff
 
Cqrs and event sourcing in azure
Cqrs and event sourcing in azureCqrs and event sourcing in azure
Cqrs and event sourcing in azureSergey Seletsky
 
Pinot: Enabling Real-time Analytics Applications @ LinkedIn's Scale
Pinot: Enabling Real-time Analytics Applications @ LinkedIn's ScalePinot: Enabling Real-time Analytics Applications @ LinkedIn's Scale
Pinot: Enabling Real-time Analytics Applications @ LinkedIn's ScaleSeunghyun Lee
 
CQRS and Event Sourcing
CQRS and Event Sourcing CQRS and Event Sourcing
CQRS and Event Sourcing Inho Kang
 
[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습
[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습
[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습Oracle Korea
 
Event Sourcing, Stream Processing and Serverless (Ben Stopford, Confluent) K...
Event Sourcing, Stream Processing and Serverless (Ben Stopford, Confluent)  K...Event Sourcing, Stream Processing and Serverless (Ben Stopford, Confluent)  K...
Event Sourcing, Stream Processing and Serverless (Ben Stopford, Confluent) K...confluent
 
CQRS + Event Sourcing
CQRS + Event SourcingCQRS + Event Sourcing
CQRS + Event SourcingMike Bild
 
Apache Flink 101 - the rise of stream processing and beyond
Apache Flink 101 - the rise of stream processing and beyondApache Flink 101 - the rise of stream processing and beyond
Apache Flink 101 - the rise of stream processing and beyondBowen Li
 
Event Driven Streaming Analytics - Demostration on Architecture of IoT
Event Driven Streaming Analytics - Demostration on Architecture of IoTEvent Driven Streaming Analytics - Demostration on Architecture of IoT
Event Driven Streaming Analytics - Demostration on Architecture of IoTLei Xu
 

Ähnlich wie TYPO3 Event Sourcing (20)

Growing into a proactive Data Platform
Growing into a proactive Data PlatformGrowing into a proactive Data Platform
Growing into a proactive Data Platform
 
Using Event Streams in Serverless Applications
Using Event Streams in Serverless ApplicationsUsing Event Streams in Serverless Applications
Using Event Streams in Serverless Applications
 
Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...
Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...
Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...
 
Hadoop Summit 2014: Processing Complex Workflows in Advertising Using Hadoop
Hadoop Summit 2014: Processing Complex Workflows in Advertising Using HadoopHadoop Summit 2014: Processing Complex Workflows in Advertising Using Hadoop
Hadoop Summit 2014: Processing Complex Workflows in Advertising Using Hadoop
 
Processing Complex Workflows in Advertising using Hadoop
Processing Complex Workflows in Advertising using HadoopProcessing Complex Workflows in Advertising using Hadoop
Processing Complex Workflows in Advertising using Hadoop
 
The Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersThe Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and Containers
 
Data Con LA 2018 - Enabling real-time exploration and analytics at scale at H...
Data Con LA 2018 - Enabling real-time exploration and analytics at scale at H...Data Con LA 2018 - Enabling real-time exploration and analytics at scale at H...
Data Con LA 2018 - Enabling real-time exploration and analytics at scale at H...
 
Realtime Analytics on AWS
Realtime Analytics on AWSRealtime Analytics on AWS
Realtime Analytics on AWS
 
data-mesh-101.pptx
data-mesh-101.pptxdata-mesh-101.pptx
data-mesh-101.pptx
 
The Great Lakes: How to Approach a Big Data Implementation
The Great Lakes: How to Approach a Big Data ImplementationThe Great Lakes: How to Approach a Big Data Implementation
The Great Lakes: How to Approach a Big Data Implementation
 
Events and microservices
Events and microservicesEvents and microservices
Events and microservices
 
Real-Time Event Processing
Real-Time Event ProcessingReal-Time Event Processing
Real-Time Event Processing
 
Cqrs and event sourcing in azure
Cqrs and event sourcing in azureCqrs and event sourcing in azure
Cqrs and event sourcing in azure
 
Pinot: Enabling Real-time Analytics Applications @ LinkedIn's Scale
Pinot: Enabling Real-time Analytics Applications @ LinkedIn's ScalePinot: Enabling Real-time Analytics Applications @ LinkedIn's Scale
Pinot: Enabling Real-time Analytics Applications @ LinkedIn's Scale
 
CQRS and Event Sourcing
CQRS and Event Sourcing CQRS and Event Sourcing
CQRS and Event Sourcing
 
[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습
[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습
[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습
 
Event Sourcing, Stream Processing and Serverless (Ben Stopford, Confluent) K...
Event Sourcing, Stream Processing and Serverless (Ben Stopford, Confluent)  K...Event Sourcing, Stream Processing and Serverless (Ben Stopford, Confluent)  K...
Event Sourcing, Stream Processing and Serverless (Ben Stopford, Confluent) K...
 
CQRS + Event Sourcing
CQRS + Event SourcingCQRS + Event Sourcing
CQRS + Event Sourcing
 
Apache Flink 101 - the rise of stream processing and beyond
Apache Flink 101 - the rise of stream processing and beyondApache Flink 101 - the rise of stream processing and beyond
Apache Flink 101 - the rise of stream processing and beyond
 
Event Driven Streaming Analytics - Demostration on Architecture of IoT
Event Driven Streaming Analytics - Demostration on Architecture of IoTEvent Driven Streaming Analytics - Demostration on Architecture of IoT
Event Driven Streaming Analytics - Demostration on Architecture of IoT
 

Mehr von Oliver Hader

T3DD23 Content Security Policy - Concept, Strategies & Pitfalls
T3DD23 Content Security Policy - Concept, Strategies & PitfallsT3DD23 Content Security Policy - Concept, Strategies & Pitfalls
T3DD23 Content Security Policy - Concept, Strategies & PitfallsOliver Hader
 
Web Application Security Workshop (T3DD19)
Web Application Security Workshop (T3DD19)Web Application Security Workshop (T3DD19)
Web Application Security Workshop (T3DD19)Oliver Hader
 
Hacking TYPO3 v9 (T3DD19 edition)
Hacking TYPO3 v9 (T3DD19 edition)Hacking TYPO3 v9 (T3DD19 edition)
Hacking TYPO3 v9 (T3DD19 edition)Oliver Hader
 
TYPO3camp Munich 2018 - Keynote - "Wo woll'n mer denn hin?"
TYPO3camp Munich 2018 - Keynote - "Wo woll'n mer denn hin?"TYPO3camp Munich 2018 - Keynote - "Wo woll'n mer denn hin?"
TYPO3camp Munich 2018 - Keynote - "Wo woll'n mer denn hin?"Oliver Hader
 
TYPO3 CMS - Datenmodifikation & Event Sourcing (Masterarbeit)
TYPO3 CMS - Datenmodifikation & Event Sourcing (Masterarbeit)TYPO3 CMS - Datenmodifikation & Event Sourcing (Masterarbeit)
TYPO3 CMS - Datenmodifikation & Event Sourcing (Masterarbeit)Oliver Hader
 
Vor- und Nachteile von Web Components mit Polymer gegenüber AngularJS ohne P...
Vor- und Nachteile von Web Components mit Polymer gegenüber AngularJS ohne P...Vor- und Nachteile von Web Components mit Polymer gegenüber AngularJS ohne P...
Vor- und Nachteile von Web Components mit Polymer gegenüber AngularJS ohne P...Oliver Hader
 
WebGL - 3D im Browser - Erfahrungsbericht mit BabylonJS
WebGL - 3D im Browser - Erfahrungsbericht mit BabylonJSWebGL - 3D im Browser - Erfahrungsbericht mit BabylonJS
WebGL - 3D im Browser - Erfahrungsbericht mit BabylonJSOliver Hader
 
Web application security
Web application securityWeb application security
Web application securityOliver Hader
 
T3CON13DE - TYPO3 CMS Team
T3CON13DE - TYPO3 CMS TeamT3CON13DE - TYPO3 CMS Team
T3CON13DE - TYPO3 CMS TeamOliver Hader
 
TYPO3camp Regensburg: TYPO3 6.0
TYPO3camp Regensburg: TYPO3 6.0TYPO3camp Regensburg: TYPO3 6.0
TYPO3camp Regensburg: TYPO3 6.0Oliver Hader
 
TYPO3 Inline Relational Record Editing (IRRE)
TYPO3 Inline Relational Record Editing (IRRE)TYPO3 Inline Relational Record Editing (IRRE)
TYPO3 Inline Relational Record Editing (IRRE)Oliver Hader
 
TYPO3 4.6 & TYPO3 4.7
TYPO3 4.6 & TYPO3 4.7TYPO3 4.6 & TYPO3 4.7
TYPO3 4.6 & TYPO3 4.7Oliver Hader
 

Mehr von Oliver Hader (14)

T3DD23 Content Security Policy - Concept, Strategies & Pitfalls
T3DD23 Content Security Policy - Concept, Strategies & PitfallsT3DD23 Content Security Policy - Concept, Strategies & Pitfalls
T3DD23 Content Security Policy - Concept, Strategies & Pitfalls
 
Web Application Security Workshop (T3DD19)
Web Application Security Workshop (T3DD19)Web Application Security Workshop (T3DD19)
Web Application Security Workshop (T3DD19)
 
Hacking TYPO3 v9 (T3DD19 edition)
Hacking TYPO3 v9 (T3DD19 edition)Hacking TYPO3 v9 (T3DD19 edition)
Hacking TYPO3 v9 (T3DD19 edition)
 
Hacking TYPO3 v9
Hacking TYPO3 v9Hacking TYPO3 v9
Hacking TYPO3 v9
 
TYPO3camp Munich 2018 - Keynote - "Wo woll'n mer denn hin?"
TYPO3camp Munich 2018 - Keynote - "Wo woll'n mer denn hin?"TYPO3camp Munich 2018 - Keynote - "Wo woll'n mer denn hin?"
TYPO3camp Munich 2018 - Keynote - "Wo woll'n mer denn hin?"
 
TYPO3 CMS - Datenmodifikation & Event Sourcing (Masterarbeit)
TYPO3 CMS - Datenmodifikation & Event Sourcing (Masterarbeit)TYPO3 CMS - Datenmodifikation & Event Sourcing (Masterarbeit)
TYPO3 CMS - Datenmodifikation & Event Sourcing (Masterarbeit)
 
Vor- und Nachteile von Web Components mit Polymer gegenüber AngularJS ohne P...
Vor- und Nachteile von Web Components mit Polymer gegenüber AngularJS ohne P...Vor- und Nachteile von Web Components mit Polymer gegenüber AngularJS ohne P...
Vor- und Nachteile von Web Components mit Polymer gegenüber AngularJS ohne P...
 
WebGL - 3D im Browser - Erfahrungsbericht mit BabylonJS
WebGL - 3D im Browser - Erfahrungsbericht mit BabylonJSWebGL - 3D im Browser - Erfahrungsbericht mit BabylonJS
WebGL - 3D im Browser - Erfahrungsbericht mit BabylonJS
 
Web Components
Web ComponentsWeb Components
Web Components
 
Web application security
Web application securityWeb application security
Web application security
 
T3CON13DE - TYPO3 CMS Team
T3CON13DE - TYPO3 CMS TeamT3CON13DE - TYPO3 CMS Team
T3CON13DE - TYPO3 CMS Team
 
TYPO3camp Regensburg: TYPO3 6.0
TYPO3camp Regensburg: TYPO3 6.0TYPO3camp Regensburg: TYPO3 6.0
TYPO3camp Regensburg: TYPO3 6.0
 
TYPO3 Inline Relational Record Editing (IRRE)
TYPO3 Inline Relational Record Editing (IRRE)TYPO3 Inline Relational Record Editing (IRRE)
TYPO3 Inline Relational Record Editing (IRRE)
 
TYPO3 4.6 & TYPO3 4.7
TYPO3 4.6 & TYPO3 4.7TYPO3 4.6 & TYPO3 4.7
TYPO3 4.6 & TYPO3 4.7
 

Último

Science9 Quarter 3:Latitude and altitude.pptx
Science9 Quarter 3:Latitude and altitude.pptxScience9 Quarter 3:Latitude and altitude.pptx
Science9 Quarter 3:Latitude and altitude.pptxteleganne21
 
layers of the earths atmosphere.ppt slides for grade 9
layers of the earths atmosphere.ppt slides for grade 9layers of the earths atmosphere.ppt slides for grade 9
layers of the earths atmosphere.ppt slides for grade 9rolanaribato30
 
The deconstructed Standard Model equation _ - symmetry magazine.pdf
The deconstructed Standard Model equation _ - symmetry magazine.pdfThe deconstructed Standard Model equation _ - symmetry magazine.pdf
The deconstructed Standard Model equation _ - symmetry magazine.pdfSOCIEDAD JULIO GARAVITO
 
Advance pharmacology presentation..............
Advance pharmacology presentation..............Advance pharmacology presentation..............
Advance pharmacology presentation..............SIMRAN VERMA
 
Mining Data for Ore Natural Language Processing to Identify Lithium Minerals ...
Mining Data for Ore Natural Language Processing to Identify Lithium Minerals ...Mining Data for Ore Natural Language Processing to Identify Lithium Minerals ...
Mining Data for Ore Natural Language Processing to Identify Lithium Minerals ...ORAU
 
Description of cultivating Duckweed Syllabus.pdf
Description of cultivating Duckweed Syllabus.pdfDescription of cultivating Duckweed Syllabus.pdf
Description of cultivating Duckweed Syllabus.pdfHaim R. Branisteanu
 
structure of proteins and its type I PPT
structure of proteins and its type I PPTstructure of proteins and its type I PPT
structure of proteins and its type I PPTvishalbhati28
 
dkNET Webinar "The Multi-Omic Response to Exercise Training Across Rat Tissue...
dkNET Webinar "The Multi-Omic Response to Exercise Training Across Rat Tissue...dkNET Webinar "The Multi-Omic Response to Exercise Training Across Rat Tissue...
dkNET Webinar "The Multi-Omic Response to Exercise Training Across Rat Tissue...dkNET
 
AI Published & MIT Validated Perpetual Motion Machine Breakthroughs (2 New EV...
AI Published & MIT Validated Perpetual Motion Machine Breakthroughs (2 New EV...AI Published & MIT Validated Perpetual Motion Machine Breakthroughs (2 New EV...
AI Published & MIT Validated Perpetual Motion Machine Breakthroughs (2 New EV...Thane Heins
 
Zoogeographical regions In the World.pptx
Zoogeographical regions In the World.pptxZoogeographical regions In the World.pptx
Zoogeographical regions In the World.pptx2019n04898
 
Skin: Structure and function of the skin
Skin: Structure and function of the skinSkin: Structure and function of the skin
Skin: Structure and function of the skinheenarahangdale01
 
Introduction to Green chemistry ppt.pptx
Introduction to Green chemistry ppt.pptxIntroduction to Green chemistry ppt.pptx
Introduction to Green chemistry ppt.pptxMuskan219429
 
Development of a Questionnaire for Identifying Personal Values in Driving
Development of a Questionnaire for Identifying Personal Values in DrivingDevelopment of a Questionnaire for Identifying Personal Values in Driving
Development of a Questionnaire for Identifying Personal Values in Drivingstudiotelon
 
AI Published & MIT Validated Perpetual Motion Machine Breakthroughs (2 New EV...
AI Published & MIT Validated Perpetual Motion Machine Breakthroughs (2 New EV...AI Published & MIT Validated Perpetual Motion Machine Breakthroughs (2 New EV...
AI Published & MIT Validated Perpetual Motion Machine Breakthroughs (2 New EV...Thane Heins
 
Production of super male Tilapia (Sex reversal techniques).pptx
Production of super male Tilapia (Sex reversal techniques).pptxProduction of super male Tilapia (Sex reversal techniques).pptx
Production of super male Tilapia (Sex reversal techniques).pptxAKSHAY MANDAL
 
Phagocytosis Pinocytosis detail presentation
Phagocytosis Pinocytosis detail presentationPhagocytosis Pinocytosis detail presentation
Phagocytosis Pinocytosis detail presentationdhaduknevil1
 
Basics Of Computers | The Computer System
Basics Of Computers | The Computer SystemBasics Of Computers | The Computer System
Basics Of Computers | The Computer SystemNehaRohtagi1
 
The GIS Capability Maturity Model (2013)
The GIS Capability Maturity Model (2013)The GIS Capability Maturity Model (2013)
The GIS Capability Maturity Model (2013)GregBabinski
 
ROLE OF HERBS IN COSMETIC SKIN CARE: ALOE AND TURMERIC
ROLE OF HERBS IN COSMETIC SKIN CARE: ALOE AND TURMERICROLE OF HERBS IN COSMETIC SKIN CARE: ALOE AND TURMERIC
ROLE OF HERBS IN COSMETIC SKIN CARE: ALOE AND TURMERICsnehalraut2002
 
Theory of indicators: Ostwald's and Quinonoid theories
Theory of indicators: Ostwald's and Quinonoid theoriesTheory of indicators: Ostwald's and Quinonoid theories
Theory of indicators: Ostwald's and Quinonoid theoriesChimwemweGladysBanda
 

Último (20)

Science9 Quarter 3:Latitude and altitude.pptx
Science9 Quarter 3:Latitude and altitude.pptxScience9 Quarter 3:Latitude and altitude.pptx
Science9 Quarter 3:Latitude and altitude.pptx
 
layers of the earths atmosphere.ppt slides for grade 9
layers of the earths atmosphere.ppt slides for grade 9layers of the earths atmosphere.ppt slides for grade 9
layers of the earths atmosphere.ppt slides for grade 9
 
The deconstructed Standard Model equation _ - symmetry magazine.pdf
The deconstructed Standard Model equation _ - symmetry magazine.pdfThe deconstructed Standard Model equation _ - symmetry magazine.pdf
The deconstructed Standard Model equation _ - symmetry magazine.pdf
 
Advance pharmacology presentation..............
Advance pharmacology presentation..............Advance pharmacology presentation..............
Advance pharmacology presentation..............
 
Mining Data for Ore Natural Language Processing to Identify Lithium Minerals ...
Mining Data for Ore Natural Language Processing to Identify Lithium Minerals ...Mining Data for Ore Natural Language Processing to Identify Lithium Minerals ...
Mining Data for Ore Natural Language Processing to Identify Lithium Minerals ...
 
Description of cultivating Duckweed Syllabus.pdf
Description of cultivating Duckweed Syllabus.pdfDescription of cultivating Duckweed Syllabus.pdf
Description of cultivating Duckweed Syllabus.pdf
 
structure of proteins and its type I PPT
structure of proteins and its type I PPTstructure of proteins and its type I PPT
structure of proteins and its type I PPT
 
dkNET Webinar "The Multi-Omic Response to Exercise Training Across Rat Tissue...
dkNET Webinar "The Multi-Omic Response to Exercise Training Across Rat Tissue...dkNET Webinar "The Multi-Omic Response to Exercise Training Across Rat Tissue...
dkNET Webinar "The Multi-Omic Response to Exercise Training Across Rat Tissue...
 
AI Published & MIT Validated Perpetual Motion Machine Breakthroughs (2 New EV...
AI Published & MIT Validated Perpetual Motion Machine Breakthroughs (2 New EV...AI Published & MIT Validated Perpetual Motion Machine Breakthroughs (2 New EV...
AI Published & MIT Validated Perpetual Motion Machine Breakthroughs (2 New EV...
 
Zoogeographical regions In the World.pptx
Zoogeographical regions In the World.pptxZoogeographical regions In the World.pptx
Zoogeographical regions In the World.pptx
 
Skin: Structure and function of the skin
Skin: Structure and function of the skinSkin: Structure and function of the skin
Skin: Structure and function of the skin
 
Introduction to Green chemistry ppt.pptx
Introduction to Green chemistry ppt.pptxIntroduction to Green chemistry ppt.pptx
Introduction to Green chemistry ppt.pptx
 
Development of a Questionnaire for Identifying Personal Values in Driving
Development of a Questionnaire for Identifying Personal Values in DrivingDevelopment of a Questionnaire for Identifying Personal Values in Driving
Development of a Questionnaire for Identifying Personal Values in Driving
 
AI Published & MIT Validated Perpetual Motion Machine Breakthroughs (2 New EV...
AI Published & MIT Validated Perpetual Motion Machine Breakthroughs (2 New EV...AI Published & MIT Validated Perpetual Motion Machine Breakthroughs (2 New EV...
AI Published & MIT Validated Perpetual Motion Machine Breakthroughs (2 New EV...
 
Production of super male Tilapia (Sex reversal techniques).pptx
Production of super male Tilapia (Sex reversal techniques).pptxProduction of super male Tilapia (Sex reversal techniques).pptx
Production of super male Tilapia (Sex reversal techniques).pptx
 
Phagocytosis Pinocytosis detail presentation
Phagocytosis Pinocytosis detail presentationPhagocytosis Pinocytosis detail presentation
Phagocytosis Pinocytosis detail presentation
 
Basics Of Computers | The Computer System
Basics Of Computers | The Computer SystemBasics Of Computers | The Computer System
Basics Of Computers | The Computer System
 
The GIS Capability Maturity Model (2013)
The GIS Capability Maturity Model (2013)The GIS Capability Maturity Model (2013)
The GIS Capability Maturity Model (2013)
 
ROLE OF HERBS IN COSMETIC SKIN CARE: ALOE AND TURMERIC
ROLE OF HERBS IN COSMETIC SKIN CARE: ALOE AND TURMERICROLE OF HERBS IN COSMETIC SKIN CARE: ALOE AND TURMERIC
ROLE OF HERBS IN COSMETIC SKIN CARE: ALOE AND TURMERIC
 
Theory of indicators: Ostwald's and Quinonoid theories
Theory of indicators: Ostwald's and Quinonoid theoriesTheory of indicators: Ostwald's and Quinonoid theories
Theory of indicators: Ostwald's and Quinonoid theories
 

TYPO3 Event Sourcing

  • 1. TYPO3 Event Sourcing Oliver Hader 11/2016 Event Sourcing … some new opportunities November 5th, 2016
  • 2. TYPO3 Event Sourcing Oliver Hader 11/2016 ~basics ~bank account example
 ~generic modelling ~opportunities
  • 3. TYPO3 Event Sourcing Oliver Hader 11/2016 DDD ~basics
  • 4. TYPO3 Event Sourcing Oliver Hader 11/2016 Domain-driven Design • book by Eric Evans, 2003 • robust & maintainable software applications • domain experts & ubiquitous language • toolbox for domain architectures
  • 5. Layered Architecture User Interface Layer Application Layer Domain Layer Infrastructure Layer Orchestrates application and domain layer Encapsulates domain and data access Encapsulates infrastructure concerns
  • 7. Bounded Contexts Customer Car Fuel CarRental car rental bounded context Car Wheel Engine Garage garage bounded context Mechanic Damage ~DomainModelCarRental ~DomainModelGarage
  • 8. TYPO3 Event Sourcing Oliver Hader 11/2016 Entities & Value Objects • make the implicit explicit • make validation part of your domain model • example for bank account number • $account-­‐>setIban('CH1504842000000000002');   • $iban  =  new  Iban('CH1504842000000000002');
 $account-­‐>setIban($iban);
  • 9. TYPO3 Event Sourcing Oliver Hader 11/2016 Events • are messages • are modelled in separate classes • concerning something that really happened • used to communicate between components • handle with observer patterns (signal-slot) • $event  =  new  ReplacedBrokenEngineEvent(…);
  • 10. TYPO3 Event Sourcing Oliver Hader 11/2016 CQRS ~basics
  • 11. TYPO3 Event Sourcing Oliver Hader 11/2016 CQS • CQS - Command Query Separation • actually defined by Bertrand Mayer in 1997 • separate processing in domain model into • write model - modify state with command • read model - fetch & represent state with query
  • 12. TYPO3 Event Sourcing Oliver Hader 11/2016 CQRS • CQRS - Command Query Responsibility Segregation • more specific & restrictive by Greg Young • segregation between write store & read store • changes trigger updates in read store • visualization just uses data-transfer objects
  • 14. TYPO3 Event Sourcing Oliver Hader 11/2016 Event Sourcing ~basics
  • 15. TYPO3 Event Sourcing Oliver Hader 11/2016 Event Sourcing • … CQRS continued & in more details • aim to persist events instead of resulting state • event stores provide read/write capabilities • applying all events results to current state again • events are projected into desired formats
  • 16. TYPO3 Event Sourcing Oliver Hader 11/2016 Events & Event Store • events are immutable • cannot be modified • cannot be deleted • legacy events must be handled • event store is consistent • events are retrieved in correct order • there are no gaps in the event history
  • 17. TYPO3 Event Sourcing Oliver Hader 11/2016 Projections • are observers & handle events • interpret and persist events to • MySQL database • filesystem, e.g. HTML • emit notifications, mails • whatever required format
  • 18. TYPO3 Event Sourcing Oliver Hader 11/2016 Materialized View • persist information for accordant requirements • forget about complex JOIN statements • data is represented denormalized • pre-process information for view • read 40 field values vs. just two are shown
  • 19. Event Sourcing Overview Command Handler Command Bus Repository ServiceEventPublisher EventHandler Denormalizer Thin Data Layer Facade Domain DTOs Commands Aggregate Events Events Events Events SQL ClientCommands Queries External Events Internal Events some query results
  • 20. TYPO3 Event Sourcing Oliver Hader 11/2016 Why??? ~basics
  • 21. TYPO3 Data Architecture Repository & Reconstitution Routing Controller View Model Permission Persistence Infrastructure Frontend Extbase Backend EditDocumentController FormEngine <<TCA>> FormDataProvider BackendUserAuthentication DataHandler RelationHandler TypoScriptFrontendController ActionContoller AbstractView AbstractEntity & AbstractValueObject Repository Typo3DbBackend Backend PersistenceManager DataMapper StandaloneView <<custom>> ConnectionPool Connection <<TCA>> AbstractPlugin ContentObjectRenderer FrontendRequestHandler BackendRouteDispatcher BackendRequestHandler MVCDispatcher <<TypoScript>> <<direct database operations>> <<direct database operations>> x x x
  • 22. Localization in TYPO3 DataHandlerController DataHandler RelationHandler DatabaseConnection translate <<create>> localize() copyRecord() <<create>> DataHandler process_datamap() last_insert_id() fetch record record [x]-processDBdata() <<create>> start() fetch references references writeForeignField() update references insert record new_record_id new_record_id new_record_id references new_record_id multipleread&writeprocesses
  • 23. Context & Overlays is translation of uid 13 sys_language_uid 0 :tt_content l10n_parent 0 header Message pid 100 t3ver_wsid 0 t3ver_state 0 t3ver_oid 0 uid 27 sys_language_uid 1 :tt_content l10n_parent 13 header Nachricht pid 100 t3ver_wsid 1 t3ver_state 1 t3ver_oid 0 uid 28 sys_language_uid 1 :tt_content l10n_parent 13 header Nachricht pid -1 t3ver_wsid 1 t3ver_state -1 t3ver_oid 27 uid 41 sys_language_uid 0 :tt_content l10n_parent 0 header News pid -1 t3ver_wsid 1 t3ver_state 0 t3ver_oid 13 is workspace version of is new version is default version is workspace version of is new palceholder
  • 24. TYPO3 Event Sourcing Oliver Hader 11/2016 Why… • is persistence and relation handling different • extbase cannot persist in workspace context • only back-end has permission layer • are context information persisted with each record • are record overlays fetched & applied each time
  • 25. TYPO3 Event Sourcing Oliver Hader 11/2016 bank account example
  • 26. TYPO3 Event Sourcing Oliver Hader 11/2016 Regular approach • using ExtensionBuilder to kick-start model • AccountController - modify & read information • AccountRepository - modify & read information • Account modelled as aggregate root • Transaction model bound to Aggregate (1:n) • using lazy-loading for Transaction entities
  • 27. TYPO3 Event Sourcing Oliver Hader 11/2016 Identify domain events • event storming is a team process • helps to combine knowledge concerning domain • in style of reverse engineering • working backwards • identify events • identify commands that lead to events • identify rules that are applied to commands
  • 29. Bank Account Example debited money debit money account not closed balance sufficient account created deposit money account not closed deposited money create account
  • 30. TYPO3 Event Sourcing Oliver Hader 11/2016 Demo & Source Code • https://github.com/TYPO3Incubator/ bank_account_example • Configuration • CommandController & ManagementController • Domain Commands & Domain Events • EventRepositories & ProjectionRepositories • Projections & Data-Transfer Objects
  • 31. TYPO3 Event Sourcing Oliver Hader 11/2016 generic modelling
  • 32. TYPO3 Event Sourcing Oliver Hader 11/2016 Generic Domain Model • no real models for most core database tables • generic models contain common aspects • identity (”tt_content:123”) • atomic, direct values • relations to other entities • ”generic“ is not domain-driven • but this concept is very useful here
  • 33. TYPO3 Event Sourcing Oliver Hader 11/2016 Generic Domain Events • created, modified, deleted ~CRUD (without R) • moved, duplicated • hidden, shown ~visibility • translated ~language context • branched, merged ~workspace context • attached, removed, ordered relation ~association
  • 34. TYPO3 Event Sourcing Oliver Hader 11/2016 Interceptors • DataHandler ~$tce->process_datamap(); • DatabaseConnection ~INSERT, UPDATE, DELETE • translate actions into generic commands • $GLOBALS['TCA'][…]['ctrl']['eventSourcing']=[
        'listenEvents'  =>  true,
        'recordEvents'  =>  true,
        'projectEvents'  =>  true,
  • 35. TYPO3 Event Sourcing Oliver Hader 11/2016 Command Upgrades • tranlate generic to specific domain commands • delegates domain control back to application • back to bank account example • does not need to implement generic commands • action in back-end form result in real commands
  • 36. TYPO3 Event Sourcing Oliver Hader 11/2016 Context & Local Storage • Materialized View on database-level • workspace and language define specific context • each context uses an individual database • information stored in SQLite locally • projections update for each context • it was named Local Storage
  • 37. Local Storage DEFAULT MySQL - _conn: DriverConnection Connection + select(...arguments[]) + insert(…arguments[]) + update(…arguments[]) + delete(…arguments[]) ORIGIN MySQL - _conn: DriverConnection Connection + select(...arguments[]) + insert(…arguments[]) + update(…arguments[]) + delete(…arguments[]) DefaultConnection LocalStorage workspace-0 SQLite - _conn: DriverConnection Connection + select(...arguments[]) + insert(…arguments[]) + update(…arguments[]) + delete(…arguments[]) DefaultConnection LocalStorage workspace-1 SQLite - _conn: DriverConnection Connection + select(...arguments[]) + insert(…arguments[]) + update(…arguments[]) + delete(…arguments[]) current state future state, context based assigned to assigned to
  • 38. TYPO3 Event Sourcing Oliver Hader 11/2016 Demo & Source Code • https://github.com/TYPO3Incubator/data_handling • Content Editing in back-end • Event Store results • Projections • Command Translations
  • 39. TYPO3 Event Sourcing Oliver Hader 11/2016 opportunities
  • 40. TYPO3 Event Sourcing Oliver Hader 11/2016 Projections! • separation between mutation & presentation • events are the new & only true source • everything else can be projected • … and re-projected if it was wrong • e.g. https://review.typo3.org/#/c/45320/ • trigger index update (Solr, Elasticsearc)
  • 41. TYPO3 Event Sourcing Oliver Hader 11/2016 Questions?
  • 42. TYPO3 Event Sourcing Oliver Hader 11/2016 Sources • Figures • “Layered Architecture“ - Buenosvinos, Carlos, Soronellas, Christian und Akbary, Keyvan. 2016. Domain- Driven Design in PHP. Victoria : Leanpub, 2016. ISBN 9780994608413 • ”CQRS Overview“ - Betts, Dominic, et al. 2013. Exploring CQRS and Event Sourcing. Redmond : Microsoft patterns & practices, 2013. ISBN 9781621140160 • ”Event Sourcing Overview“ - Nijhof, Mark. 2013. CQRS, The example. Victoria : Leanpub, 2013. ISBN 9781484102879 • GitHub source codes • https://github.com/TYPO3Incubator/bank_account_example • https://github.com/TYPO3Incubator/data_handling • Master Thesis on Event Sourcing (German only) • https://get.h4ck3r31.net/T3CRR16-HwWL498EvURCxnnittPoHyNrXkN3xi/ Hader_Oliver_TYPO3_EventSourcing.pdf
  • 43. TYPO3 Event Sourcing Oliver Hader 11/2016 Thank you! ohader
 @ohader
 Oliver_Hader follow mehttps://h4ck3r31.net