70
Broken Promises kiki @ lightbend @kikisworldrace

Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Broken Promises

kiki @ lightbend

@kikisworldrace

Page 2: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Data is dangerous

Page 3: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Microservices are usually required to cooperate to achieve some end

goal.

Page 4: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Microservices need to be able to trust each other in order to

cooperate.

Page 5: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Microservices cooperate, they are symbiotic but not parasitic.

Page 6: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Microservices have a relationship to each other, but also a relationship with data.

Page 7: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

There are different types of data that microservices must deal with.

1. Agent internal-data (aka entities)2. Persisted Data3. External Service Data

Page 8: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

How data destroys relationships: Data can Lie

1.Lies of omission2.Lies of commission

Page 9: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

How data destroys relationships: Data can be Corrupt

Corrupted by good or bad actors.

Page 10: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

How data destroys relationships: Data can be high maintenance.

Hard to secure some, but everyone pays the price.

Page 11: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

How data destroys relationships: Data is dumb.

Data is not self-aware.

Page 12: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

How data destroys relationships: Data is dumb.

Data is too dumb to drive things. To drive something you need to know

direction, how to steer, how to interpret.

Page 13: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

How data destroys relationships: Data is dumb.

Data can only inform.

Page 14: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

How data destroys relationships: Data is dumb.

Stateless Architecture, another broken promise…

Page 15: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

If a microservice cannot rely on data to properly inform, then

what?

Page 16: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

We need trust.

Page 17: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Microservices be able to make and keep promises.

Page 18: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Promise theory is an engineering framework for coping with

uncertainty in information systems.

Page 19: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Promise theory is an engineering framework for coping with

uncertainty in information systems.

Page 20: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Promise theory is an engineering framework for coping with

uncertainty in information systems.

Page 21: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Promise theory is an engineering framework for coping with

uncertainty in information systems.

Page 22: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Uncertainty Divergence vs Convergence

Page 23: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Uncertainty Divergence vs Convergence

Page 24: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Uncertainty Divergence vs Convergence

Page 25: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Promises help you converge.

Page 26: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Obligations aren’t better?

Page 27: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Back to data and winning back trust

Page 28: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Facts

AKA Events

Page 29: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Facts• Should be immutable

• Should be relevant, or germane to the state at play• Could be used to assess whether a promise has

been kept.

Page 30: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

OpinionsAKA Views

Page 31: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Opinions• Views should be generated as a result of ingesting facts.

• Views should be based on facts. • Could be used to broadcast whether a promise was kept.

Page 32: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Systems are composed of facts, opinions. States and views.

Page 33: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Give data benevolent masters or stewards capable of making and

keeping promises.

Page 34: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

What makes a good steward of state?

Page 35: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

What makes a good steward of state?

Should be smart, intelligent, knowledgeable

Page 36: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

What makes a good steward of state?

Should produce the right, relevant data for its state.

Page 37: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

What makes a good steward of state?

Should know what is a good fact vs a bad fact.

Page 38: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Masters need to have clear properly managed boundaries.

Context matters.

Page 39: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Masters need to have clear properly managed boundaries.

Context matters.

Page 40: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Masters should be resistant to corruption.

Page 41: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

A good master is autonomous and responsible.

Page 42: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

How does a stateful steward repair itself?

Page 43: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

How does a stateful steward repair itself?

By rebuilding the state from events.

Page 44: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

How does a stateful steward repair itself?

By using compensating actions.

Page 45: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

How does a stateful steward repair itself?

Having and executing on info to resolve conflicts.

Page 46: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

How does a stateless advisor, view creator, repair?

Page 47: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

How does a stateless advisor, view creator, repair?

Rebuild views.

Page 48: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Some views need to be fact based, others do not.

Page 49: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Some views need to be fact based, others do not.

Page 50: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Some views need to be fact based, others do not.

Page 51: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Good masters aren’t data-driven, they drive the data

Page 52: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Data should be isolated

Isolation; bad for humans, good for data

Page 53: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Promote Isolation & Autonomy by Separating Facts from Views

Facts Views

Service Implementation

State Changing Requests

Data View Requests

Service API

Page 54: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Enter Lagom

Page 55: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Lagom empowers your master stewards through isolation,

autonomous services

Page 56: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Remember - different types of data that microservices must deal with.

1. Agent internal-data (aka entities)2. Persisted Data3. External Service Data

Page 57: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Account Context

accountA

accountC

accountB

$$

Current Account

Balance is the State

Agent Internal Data

Page 58: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Lagom Encourages and Enables You to Contain Mutable State &

Publish Facts

Page 59: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Storefactsassourceoftruth

Entity with published intent

Page 60: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Storefactsassourceoftruth

Command + Outer Boundary Call

Page 61: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

AlwaysMaintainaCurrentview

ofState

Entities in a Cluster

Page 62: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Lagom Allows you specialize in order to have the right properties

for stewarding events/views.

Page 63: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Stateful Agents

FACTS VIEWS

Stateless Agents

Page 64: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Account Context

accountA

accountC

accountB

$$ You can do transactions in

the boundary of your persistent

entity

Page 65: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Shopping Context

Checkout Context Payments Context

Fulfillment Context

Order ContextManages Saga

Page 66: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Lagom uses asynchronous messaging, asynchronous IO &

distributed persistence patterns

Page 67: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

clientco

mm

and

com

man

d

node

nodenodenode

Reactive programmingREST messaging streaming

Stateless Behavior

node

Reactive programming

Stateful Entity

Write model event log

DS

Event (fact)

Event (fact)

Read model query db

DS

Event (fact) Event (fact)

Service discovery

Service gateway

Authentication

command

command

command

Reac

tive

Syst

em

Page 68: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

data

spring

play

akka

akka

JavaRX

Reactive System

Reactive Systems design is used in between the Microservices, allowing the creation of systems of Microservices that play by the rules of distributed systems—Responsiveness through Resilience and Elasticity made possible by being Message-Driven.

Page 69: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

SummaryData can hurt relationships if you let it.

Build trust by managing data with specialized stewards.

Empower your entities to keep their promises.

Managing state requires care, awareness.

Distributed systems require a level up on the care.

Page 70: Broken Promises - JfokusReactive System Reactive Systems design is used in betweenthe Microservices, allowing the creation of systems of Microservices that play by the rules of distributed

Summary

https://github.com/kikiya/wallet-exercise