query or command - toruń jug...vert.x - asynchronous web communication rxjava - reactive view...

21
Query or Command (Short) Introduction to CQRS Zbyszko Papierski Solutions Architect @ allegro.pl Twitter: @ZPapierski Linkedin: https://www.linkedin.com/in/zbyszko

Upload: others

Post on 22-May-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes

Query or Command(Short) Introduction to CQRS

Zbyszko PapierskiSolutions Architect @ allegro.plTwitter: @ZPapierskiLinkedin: https://www.linkedin.com/in/zbyszko

Page 2: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes

C.R.U.D.

Page 3: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes

CommandQueryResponsibilitySegregation

Greg Young

Bertrand Meyer

Martin Fowler

Page 4: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes

Command (vs) Query

Page 5: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes

Responsibility Segregation

Page 6: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes
Page 7: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes
Page 8: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes
Page 9: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes

NOT one style to rule them all

Page 10: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes

scalable but

eventually consistent

Page 11: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes

more elasticbut

more (globally) complex

Page 12: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes

What’s next?

Page 13: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes

Event Sourcing

Page 14: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes

Task Based UI

Google says you don’t need that save button...

Page 15: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes

Technology Stack?

Page 16: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes

Axon Framework

Jdon

Anything you like

Page 17: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes

Stack Example - communication

● Kafka - distributed pub/sub● AngularJS - js framework with good

ansychronous mechanisms● Vert.X - asynchronous web

communication● RxJava - Reactive view changes

Page 18: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes

Stack Example - db solutions

● any db you need ● Cassandra - extremely fast writes and

pretty fast reads● MongoDB - fast document store● Akka Persistence - great

implementation of Event Sourcing

Page 19: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes

Key Takeaways

● As always - “right tool for the job”● Build your views asynchronously● Consider what is the best model for

each query and each command● Consider your consistency and

performance requirements

Page 20: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes

Mandatory Links Slide

● https://cqrs.wordpress.com/ - not updated, but interesting read

● http://martinfowler.com/bliki/CQRS.html - Martin Fowler on CQRS

● http://www.axonframework.org/ ● http://en.jdon.com/

Page 21: Query or Command - Toruń JUG...Vert.X - asynchronous web communication RxJava - Reactive view changes Stack Example - db solutions any db you need Cassandra - extremely fast writes

???