There are no good ways to integrate microservices @gamussa
|
#springone
|
@confluentinc
Slide 20
There are no-good ways to integrate microservices @gamussa
|
#springone
|
@confluentinc
Slide 21
Filesystem @gamussa
|
#springone
|
@confluentinc
Slide 22
@gamussa
|
#springone
|
@confluentinc
Slide 23
Database @gamussa
|
#springone
|
@confluentinc
Slide 24
@gamussa
|
#springone
|
@confluentinc
Slide 25
Integrating Microservices through the database
• “I have a database and I know how to use it.” • Eventually causes services to co-mingle. • Violation the «bounded context» • Great to use inside a service boundary! • Terrible for sharing data or negotiating change.
@gamussa
|
#springone
|
@confluentinc
Slide 26
RPC @gamussa
|
#springone
|
@confluentinc
Slide 27
@gamussa
|
#springone
|
@confluentinc
Slide 28
Integrating microservices via RPC
• Avoids problems of database integration • Feels natural • Aligns with the request/ response paradigm • Problem: cascading failures • Question: how do you debug this system?
🤔
• Answer: you build a log. @gamussa
|
#springone
|
@confluentinc
Slide 29
Log4j type of log? @gamussa
|
#springone
|
@confluentinc
🤔
Slide 30
Events? @gamussa
|
#springone
|
@confluentinc
Slide 31
What’s an event? @gamussa
|
#springone
|
@confluentinc
Slide 32
an occurrence, especially one of some importance.
@gamussa
|
#springone
|
@confluentinc
Slide 33
A combination of: Notification State transfer @gamussa
|
#springone
|
@confluentinc
Slide 34
Also, events are immutable. @gamussa
|
#springone
|
@confluentinc
A Richer Microservices Application @gamussa
|
#springone
|
@confluentinc
Slide 39
@gamussa
|
#springone
|
@confluentinc
Slide 40
Ratings Service operating on the event stream Browser
ratings Ratings Service
Webserver
Order rawRequested
rating
ratings
ratings counts
KStreams API used to count and sum ratings as they arrive
ratings sums
KAFKA @gamussa
|
@
#springone
|
@confluentinc
Slide 41
Schema Management Browser
ratings Ratings Service
Webserver
Order rawRequested
rating
ratings
ratings counts
KStreams API used to count and sum ratings as they arrive
ratings sums
KAFKA @gamussa
|
@
#springone
|
@confluentinc
Schema Registry
Slide 42
Access legacy relation data Browser
ratings Ratings Service
Webserver
Order rawRequested
rating
Connect
ratings
ratings counts
KStreams API used to count and sum ratings as they arrive
ratings sums
KAFKA @gamussa
|
@
#springone
|
@confluentinc
Movies
Schema Registry
Slide 43
Materialize tables inside the app Browser
ratings Ratings Service
Movies
Lookup table created inside the Rating Service
Webserver
Order rawRequested
rating
Connect
ratings
ratings counts
ratings sums
KAFKA @gamussa
|
@
#springone
|
@confluentinc
Movies
Schema Registry
Slide 44
Create a new table, persist it to the log Browser
ratings rated-movies Ratings Service
Writable table created for rated movies
Movies
Webserver
Order rawRequested
rating
Connect
ratings
ratings counts
ratings sums
KAFKA @gamussa
|
@
#springone
|
@confluentinc
Movies
rated-movies Schema Registry
Slide 45
Create a new table, persist it to the log Browser
ratings rated-movies Ratings Service
Movies
TRANSACTION
Webserver
Order rawRequested
rating
Connect
ratings
ratings counts
ratings sums
KAFKA @gamussa
|
@
#springone
|
@confluentinc
Movies
rated-movies Schema Registry
Slide 46
Hydrate a materialized view Browser
ratings Ratings Service
an embedded database CDC
Webserver
Order rawRequested
rating
Connect
ratings
ratings counts
ratings sums
Movies
rated-movies
KAFKA @gamussa
|
@
#springone
|
@confluentinc
Schema Registry
Slide 47
What did you learn today?
• Streaming services improve on the traditional microservices pattern in a number of ways: • Decouple ecosystems for easier change • Evolve existing databases into event streams with Kafka Connect. • Build on asynchronicity first. Add synchronicity where needed.
@gamussa
|
#springone
|
@confluentinc
Slide 48
What did you learn today?
• Remove the need for circuit breakers or other “overload” patterns. • Quickly combine and operate on data from many different services. • Embrace an immutable log that can be replayed. • Keep many databases, in many independent services, in sync. • Safely manage the evolution of data with the schema registry.
@gamussa
|
#springone
|
@confluentinc
Slide 49
Want to learn more? @gamussa
|
#springone
|
@confluentinc
Slide 50
https://gamov.dev/spring20
Slide 51
Learn Kafka. Start building with Apache Kafka at Confluent Developer. developer.confluent.io
Watch full version https://gamov.dev/developer