made in heaven cqrs and iot: a matchiotdayit.org/slides/cqrs_and_iot.pdf · • approccio ad-hoc...
TRANSCRIPT
![Page 1: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/1.jpg)
THE STRONGEST WOOD TECHNOLOGIES ARE IN OUR DNA
CQRS and IoT: A match made In Heaven28/11/2019
![Page 2: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/2.jpg)
Who Am I?
Carmine IngaldiDigital Services Team @ SCM Group SpA
Software EngineerInterested in IoT, Microservice Architectures, DevOps, Big DataAgile BelieverBass Player & Former DJNeapolitan
www.linkedin.com/in/carmine-ingaldi
https://github.com/cingaldi
![Page 3: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/3.jpg)
3
The Group companies, operating throughout the world, are reliable partners of leading companies in various market sectors, including:FurnitureConstructionAutomotiveAerospaceShip-buildingPlastic processing industries
A technology world leader in processing a wide variety of materials: wood, plastic, glass, stone, metal and composites.
What is SCM Group?
![Page 4: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/4.jpg)
4
Facts&
Figuresabout 700 M€ year revenue
4 main production sites
5 continents selling and servicing
3.600 peoplein Italy and other Countries
7% revenue in R&D investments
What is SCM Group?
![Page 5: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/5.jpg)
WE ARE HIRING!!
![Page 6: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/6.jpg)
Abstract
![Page 7: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/7.jpg)
IoT and Industrial IoT
Approccio “Broke”● Sensorizza il tuo prodotto
● Mostra dati su una web dashboard
● Aspetta il successo
● BONUS: “predictive” a caso
![Page 8: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/8.jpg)
IoT and Industrial IoT
Approccio “Woke”● Colleziona informazioni
○ Sui tuoi prodotti in campo○ Sul comportamento dei tuoi
clienti● Estrai conoscenza● Migliora il tuo prodotto● Migliora i tuoi processi● Migliora l’esperienza d’uso del
prodotto
![Page 9: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/9.jpg)
How and Why?
![Page 10: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/10.jpg)
How and Why?
![Page 11: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/11.jpg)
CQRS - Definition
CQRS stands for Command Query Responsibility Segregation. [...]. At its heart is the notion that you can use a different model to update information than the model you use to read information. For some situations, this separation can be valuable, but beware that for most systems CQRS adds risky complexity.
(M. Fowler)https://martinfowler.com/bliki/CQRS.html
![Page 12: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/12.jpg)
Is This Evil?
![Page 13: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/13.jpg)
CRUD Model
un CRUD model è realizzato a partire dalla definizione di uno schema dei dati e decidendo quali metodi di accesso offrire al client su ogni risorsa
Le mutazioni e le osservazioni dello stato di un’applicazione hanno rappresentazioni tra loro compatibili
![Page 14: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/14.jpg)
CRUD Model
![Page 15: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/15.jpg)
CRUD Model
Nell’ IoT gli utenti sono umani e devices….parlano lingue differenti
![Page 16: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/16.jpg)
Da CRUD a CQRS
• Create• Read• Update• Delete
• Command• Query• Responsibility• Segregation
![Page 17: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/17.jpg)
CQRS Model
Il dominio viene rappresentato ancora attraverso risorse intercorrelate, ma l’azione del client sullo stato del sistema è esplicitamente espressa in termini di mutazioni ed osservazioni dello stato
una mutazione -> più rappresentazioni
![Page 18: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/18.jpg)
CQRS Model Attuale
![Page 19: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/19.jpg)
CQRS Model
Trend
![Page 20: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/20.jpg)
CQRS Model
Storico
![Page 21: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/21.jpg)
CQRS Model
Progettare l’applicazione in due tipi di componenti indipendenti:● Componente di aggiornamento
dello stato (write/command side)● Componente di osservazione dello
stato (read/query side)
Per ogni command side possono esistere più read sides (proiezioni)
Il dominio è rappresentato in modi diversi a partire dallo stesso modello
![Page 22: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/22.jpg)
Key Concepts
![Page 23: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/23.jpg)
Domain Driven Design
Rappresentare la conoscenza del dominio di business attraverso un linguaggio condiviso che descrive concetti e comportamenti
![Page 24: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/24.jpg)
Aggregates (CRUD-ish)
![Page 25: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/25.jpg)
Aggregates (CRUD-ish)
![Page 26: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/26.jpg)
Aggregates (CRUD-ish)
![Page 27: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/27.jpg)
Aggregates
Le informazioni in un aggregato sono sempre consistenti. La aggregate root è il concetto principale da cui dipendono gli altri. Cambiare lo stato dell’aggregato vuol dire effettuare un’operazione (comando) sulla aggregate root
Se l’aggregato diventa “distribuito” dobbiamo fare di più per garantire la consistenza!
![Page 28: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/28.jpg)
From Command to Event
Un evento è la notifica che È AVVENUTO un cambiamento di stato in un sistema
![Page 29: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/29.jpg)
Event Driven Architecture
Progettare un’applicazione i cui componenti interagiscono tra loro non soddisfando richieste, ma reagendo ad eventi
![Page 30: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/30.jpg)
Event Driven or Message Driven?
Un’ applicazione IoT ha una natura Event Driven: La piattaforma raccoglie eventi nel mondo fisico ed orchestra servizi per fornire feedback e compiere azioni sul mondo fisico
![Page 31: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/31.jpg)
You’re Already into EDA
![Page 32: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/32.jpg)
Event Driven or Message Driven?
Vantaggi
• Disaccoppiamento• Sistemi Resilienti• Consistenza• Backpressure
Svantaggi
• Spaghetti Flow• “Single” Point of Failure• Consistenza eventually• Memory Intensive
![Page 33: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/33.jpg)
From Event Driven to Event Sourcing
Lo stato attuale di un’applicazione è il risultato di una sequenza di eventi
E se l’applicazione persistesseuna sequenza di eventi anziché uno stato?
![Page 34: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/34.jpg)
From Event Driven to Event Sourcing
https://docs.microsoft.com/it-it/azure/architecture/patterns/event-sourcing
![Page 35: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/35.jpg)
Risks and Benefits of ES
![Page 36: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/36.jpg)
Risks and Benefits of ES
Vantaggi
• Applicazioni Evolutive• Audit Logging• Consistenza• Single Source of Truth• Testabilità
Svantaggi
• Il DB cresce nel tempo• Approccio ad-hoc per
schema-changes• Difficile comprendere lo
stato delle informazioni persistite
![Page 37: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/37.jpg)
Interacting Withthe Outside
![Page 38: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/38.jpg)
Interacting With the Outside
![Page 39: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/39.jpg)
Interacting Withthe Outside
![Page 40: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/40.jpg)
Interacting Withthe Outside
![Page 41: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/41.jpg)
Interacting Withthe Outside
• Atomic• Consistent• Isolated• Durable
• Basically • Available• Soft state• Eventually consistent
![Page 42: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/42.jpg)
Sagas / Event Processors
Process Manager : Gestisce transazioni distribuite complesse garantendo consistenza (eventually) e uno stato persistente
Saga: Gestisce una Long Term Transaction non atomica: Per ogni comando esiste un’operazione correttiva che viene applicata in caso di errore
![Page 43: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/43.jpg)
Sagas and Event Processing
Saga
• Object Oriented Design• Manages processes• Addresses concurrency
Stream Processing (CEP)
• Functional Definition• Applies operators• Addresses parallelism
https://www.confluent.io/blog/event-sourcing-cqrs-stream-processing-apache-kafka-whats-connection/
![Page 44: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/44.jpg)
Summing Up!
![Page 45: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/45.jpg)
A New Reference Architecture
![Page 46: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/46.jpg)
A New Reference Architecture
![Page 47: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/47.jpg)
A New Reference Architecture
![Page 48: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/48.jpg)
A New Reference Architecture
![Page 49: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/49.jpg)
A New Reference Architecture
![Page 50: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/50.jpg)
A New Reference Architecture
![Page 51: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/51.jpg)
A New Reference Architecture
![Page 52: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/52.jpg)
SmartLight App
Da utente smartlight, voglio accendere e spegnere una luce in una stanza tramite API, così posso gestire l’illuminazione anche da remoto
Da utente smartlight, voglio ricevere lo stato delle luci in una stanza, così posso controllare l’illuminazione della mia casa
BONUS
Da utente smartlight, voglio conoscere il tempo totale di accensione delle luci in una stanza, così posso tenere sotto controllo il consumo energetico
![Page 53: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/53.jpg)
SmartLight App
![Page 54: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/54.jpg)
SmartLight App
![Page 55: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/55.jpg)
Conclusions
![Page 56: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/56.jpg)
Conclusions
Questo approccio è adatto quando• Le informazioni contano più dei dati• E’ forte il legame tra la realtà fisica e il modello digitalizzato• L’applicazione reagisce ad eventi• L’applicazione gestisce interazioni complesse tra sistemi
indipendenti• Il prodotto evolve rapidamente• Le condizioni di carico possono variare rapidamente
![Page 57: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/57.jpg)
Conclusions
Rischi:• Perdere il controllo del comportamento globale del sistema• Complessità di gestione dell’infrastruttura• Tecnologie non mainstream• Rende semplici cose complesse, ma rende complesse le cose
semplici
![Page 58: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/58.jpg)
Conclusions
CQRS (& friends) <3 IoT• Trasforma eventi in insight• Adatto a sistemi distribuiti• Pensa in maniera event-driven• Pensa in maniera asincrona, reattiva
![Page 59: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/59.jpg)
?
![Page 60: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/60.jpg)
Thank you for Your Time!
![Page 61: made In Heaven CQRS and IoT: A matchiotdayit.org/slides/cqrs_and_iot.pdf · • Approccio ad-hoc per schema-changes • Difficile comprendere lo stato delle informazioni ... Gestisce](https://reader033.vdocuments.us/reader033/viewer/2022042319/5f0954a77e708231d42651d1/html5/thumbnails/61.jpg)
P.S.