SlideShare une entreprise Scribd logo
1  sur  32
Télécharger pour lire hors ligne
Events & Microservices
Saul	
  Caganoff,	
  CTO	
  Sixtree
saul@sixtree.com.au
@scaganoff
Introduction
• Asynchrony	
  is	
  considered	
  a	
  microservice	
  
characteristic
– But	
  not	
  often	
  discussed
• In	
  the	
  top	
  20	
  Google	
  results
– 7	
  mentioned	
  async/choreography	
  or	
  events
– 3	
  of	
  those	
  by	
  Chris	
  Richardson	
  or	
  Martin	
  Fowler
• Mostly	
  mentioned	
  in	
  passing
• Honourable	
  Mentions:
– http://www.infoq.com/articles/microservices-­‐intro
– http://highscalability.com/blog/2014/4/8/microservices-­‐not-­‐a-­‐free-­‐
lunch.html
WHY EVENTS?
Bounded Contexts
Finance
Sales
Fulfilment
Product
Online	
  bookstore	
  is	
  
the	
  “Hello	
  World”	
  of	
  
enterprise	
  systems
http://maribyrnong.com.au
Sales Context
Wishlist
Book
ISBN
Title
Author
Price
Order
Status
Timestamp
Sub-­‐total
GST
Total
Item
Quantity
History
Customer
Name
Age
Loyalty	
  Status
Finance Context
Wishlist
Book
ISBN
Title
Author
Price
Order
Status
Timestamp
Sub-­‐total
GST
Total
Item
Quantity
History
Customer
Name
Age
Loyalty	
  Status
Credit	
  Card
Holder	
  Name
Number
Expiry
Code
Fulfilment Context
Book
ISBN
Title
Customer
Name
Receipt
Order	
  Number
Sub-­‐total
GST
Total
Address
Street	
  Number
Street	
  Name
Suburb
Postcode
Courier
Depot
Location
Driver
Shipment
Dispatch	
  Time
ETA
Location
Product Context
Book Description
Abstract
Picture
Review
Author
Name
Biography
Inventory
Location
Quantity
ISBN
Title
Price
Coupling & Cohesion
• Cohesion – how	
  well	
  a	
  subsystem	
  forms	
  a	
  
uniting	
  whole
– How	
  well	
  a	
  bounded	
  context	
  does	
  its	
  job
• Coupling – the	
  propensity	
  for	
  change	
  in	
  one	
  
part	
  of	
  a	
  system	
  to	
  disrupt	
  another
– how	
  badly	
  “stuff”	
  leaks	
  across	
  the	
  boundaries
• Coupling	
  is	
  evil	
  – it	
  sneaks	
  into	
  solutions	
  in	
  all	
  
kinds	
  of	
  insidious	
  ways
Coupling & Cohesion
• Microservices strive to	
  eliminate	
  coupling
• Insidious	
  sources	
  of	
  coupling
– Shared	
  databases
– Single	
  Common	
  Data	
  Model	
  (vs	
  bounded	
  contexts)
– DRY	
  – shared	
  code
– APIs	
  generated	
  from	
  code
– Autogenerated client	
  SDKs
– Projects	
  – funding	
  and	
  scope
– Assumptions	
  about	
  business	
  processes
– Organizational	
  structure
Business Processes
• End-­‐to-­‐end	
  business	
  processes	
  require	
  
coordination	
  across	
  bounded	
  contexts
Finance
Sales
Ful-­‐
filment
Product
Business Processes
• Browse	
  the	
  inventory
• Create	
  order
• Enter	
  Shipping	
  Details
• Quote	
  shipping	
  charge
• Make	
  the	
  payment
• Update	
  inventory
• Create	
  Shipment
• Pick	
  &	
  Pack
• Courier
• Accept	
  delivery
GET	
  /products
POST	
  /order
PUT	
  /order/:id/address
GET	
  /3pl/charges?zip=…
POST	
  /finance/payment?order=
POST	
  /products
POST	
  /3pl/shipment
GET	
  /3pl/shipment/:id
GET	
  /3pl/shipment/:id/address
PUT	
  /3pl/shipment/:id?status=
Business Processes
• Orchestration	
  
– Centralized	
  coordination
– E.g.	
  the	
  user-­‐agent,	
  BPM	
  engine,	
  service	
  facade
– the	
  “god”	
  object
• Hypermedia
– HATEOAS
– But	
  what	
  about	
  at	
  the	
  edges?
– How	
  much	
  should	
  one	
  BC	
  know	
  about	
  another	
  BC?
“microservices architecture	
  will	
  never	
  be	
  SOA	
  done	
  right	
  unless	
  it	
  means	
  building	
  
hypermedia	
  systems	
  of	
  microservices”	
  – Jason	
  Bloomberg
http://intellyx.com/2015/07/20/are-­‐microservices-­‐soa-­‐done-­‐right/
Some Perspective
0
2
4
6
8
10
12
DB	
  Triggers Monolith Orchestration Hypermedia EDA
Coupling
Data Synchronization
• How	
  to	
  handle	
  data	
  “owned”	
  by	
  multiple	
  
domains
– Glibness: “don’t”	
  have	
  multiple	
  data	
  owners
– …in	
  reality	
  it	
  is	
  impossible	
  to	
  eliminate
– …especially	
  if	
  legacy	
  or	
  COTS	
  systems	
  involved.
• Some	
  data	
  synchronization	
  is	
  naturally	
  
conveyed	
  by	
  the	
  business	
  process
• …some	
  is	
  not.
Choreography
• Use	
  events	
  to	
  coordinate	
  activity	
  across	
  bounded	
  
contexts
• Publishers	
  &	
  Subscribers	
  are	
  highly	
  decoupled
– Event	
  subscribers	
  can	
  come	
  &	
  go	
  minimal	
  or	
  no	
  code	
  
or	
  configuration	
  changes
• Publishers	
  &	
  Subscribers	
  are	
  more	
  resilient	
  to	
  
change	
  – either	
  planned	
  or	
  unplanned
– E.g.	
  events	
  redelivered	
  in	
  the	
  event	
  of	
  subscriber	
  
failure	
  – either	
  to	
  the	
  restored	
  subscriber,	
  or	
  a	
  
replacement
Choreography
• But	
  trade-­‐offs
• Asynchronous	
  events	
  lie	
  at	
  the	
  heart	
  of	
  some	
  of	
  
the	
  microservices challenges
– Centralised	
  orchestration	
  is	
  harder	
  to	
  change,	
  but	
  
easier	
  to	
  control/monitor
– Event-­‐based	
  choreography	
  is	
  easier	
  to	
  change	
  but	
  
harder	
  to	
  control/monitor
• Distributed	
  logging/monitoring	
  systems	
  are	
  
needed	
  to	
  provide	
  a	
  view	
  into	
  asynchronous	
  
interactions
Coordination
• Think	
  about	
  hypermedia	
  inside	
  boundaries
• Events	
  outside	
  the	
  boundaries
Finance
Sales
Ful-­‐
filment
Product
MODELLING EVENTS
Commands & Events
• Duality	
  between	
  commands	
  &	
  events
– Commands	
  cause	
  state	
  transitions
– Events	
  reflect	
  state	
  transitions
• An	
  external	
  observer	
  can	
  infer	
  the	
  state	
  of	
  a	
  
resource	
  from	
  its	
  event-­‐stream
– This	
  is	
  the	
  essence	
  of	
  event-­‐sourcing	
  &	
  CQRS
State Modelling
Empty
Cart
Full
Cart
Quoted
Paid
POST	
  /cart
PUT	
  /cart/:id
{	
  book:	
  …	
  }
PUT	
  /cart/:id
{	
  book:	
  …	
  }
DELETE	
  /cart/:id/books/:id
PUT	
  /cart/:id
{	
  address:	
  …	
  }
POST	
  /payments
{	
  cart:	
  …,	
  card:	
  {…}}
Commands	
  (HATEOAS)
{create:	
  {	
  cart:	
  …	
  }	
  …	
  }
{add:	
  {	
  cart:	
  …,	
  book:	
  {…}}	
  ..}
{add:	
  {	
  cart:	
  …,	
  book:	
  {…}}	
  ..}
{del:	
  {	
  cart:	
  …,	
  book:	
  {…}}	
  ..}
{quoted:	
  {	
  cart:	
  …	
  }	
  …	
  }
{paid:	
  {	
  cart:	
  …	
  }	
  …	
  }
Events	
  (EATNOAS)
Commands & Events
Finance
Sales
Ful-­‐
filment
Product
Inventory
Marketing
Commands
Events
Reporting
Logistics
Event Structure
• Immutable	
  structures
• Typical	
  properties
– Timestamp
– Source
– Entity	
  URI
– Action	
  (state	
  transition)
• The	
  MVP	
  is	
  to	
  notify	
  that	
  a	
  resource	
  has	
  
changed	
  and	
  allow	
  subscribers	
  to	
  pull	
  the	
  
update	
  if	
  needed.
Concurrency
• Race	
  Conditions
• The	
  importance	
  of	
  order
• Single	
  Master	
  vs	
  Multi-­‐Master
• Deltas	
  vs	
  Copies
• Action	
  indicators
• CRDTs	
  – conflict-­‐free	
  replicated	
  data	
  types
• …think	
  in	
  terms	
  of	
  events	
  rather	
  than	
  copies
EVENT TRANSPORTS
Syndication
• Service	
  exposes	
  an	
  RSS/atom	
  feed
• Consumers	
  do	
  all	
  the	
  hard	
  work:
– Subscription
– State	
  Management	
  (where	
  am	
  I	
  up	
  to?)
– Retries
• Positives
– Very	
  easy…well-­‐known	
  pattern
– Web-­‐scale
• Negatives
– Polling
– High	
  latency
Web Hooks
• Service	
  POSTs	
  events	
  to	
  subscribers
• Publishers	
  do	
  all	
  the	
  hard	
  work:
– Manage	
  subscribers
– Managed	
  guaranteed	
  delivery/	
  retries
• Positives
– Not	
  polling,	
  relatively	
  lower	
  latency
• Negatives
– Subscription	
  management	
  &	
  guaranteed	
  delivery	
  
must	
  be	
  done	
  yourself…can	
  be	
  tricky.
Message Queues
• Events	
  published	
  to	
  queues/topics
– E.g JMS,	
  AMQP,	
  ZMQ,	
  SQS/SNS,	
  IronMQ
• Positives
– Mature,	
  well-­‐known	
  technologies
– Good	
  open-­‐source	
  implementations	
  available
– Competing	
  consumer	
  pattern
• Negatives
– Extra	
  infrastructure
– Reliability	
  depends	
  on	
  reliable	
  file-­‐systems	
  
• SANs,	
  Distributed	
  file-­‐lock	
  managers
Apache Kafka
• Distributed	
  log
• Similar	
  model	
  to	
  syndication
– Single	
  node	
  shares	
  data	
  by	
  writing	
  to	
  logfiles
– Consumers	
  tail	
  the	
  logs
• Consumers	
  control	
  their	
  position	
  in	
  the	
  log
• Low	
  latency
• Reliability	
  handled	
  at	
  the	
  application	
  layer
– whether	
  Zookeeper	
  is	
  less	
  burdensome	
  than	
  clustered	
  
file	
  system	
  is	
  up	
  to	
  you
Event Processing
• Simple	
  events	
  are	
  very	
  useful	
  for	
  data	
  
synchronization	
  or	
  process	
  coordination
• Continuum	
  of	
  complexity
• Some	
  tools:	
  Drools,	
  Riemann.io,	
  Apache	
  Storm
• This	
  is	
  a	
  whole	
  ‘nother topic
Cardinality State Tools
Single	
  event Simple Event	
  processor
Multiple	
  events/stream Simple Stream	
  processor
Multiple	
  events/stream Complex	
  /	
  Rules Complex	
  Event	
  Processor
Wrap-Up
• Bounded	
  contexts	
  are	
  important
– they	
  promote	
  cohesion	
  and	
  reduce	
  coupling
• You	
  need	
  to	
  decide	
  how	
  to	
  coordinate	
  data	
  &	
  
processes	
  across	
  boundaries
– Orchestration	
  (relatively	
  higher	
  coupling)
– Hypermedia	
  (couples	
  across	
  boundaries)
– Events
• Prefer	
  Hypermedia	
  within	
  bounded	
  contexts	
  &	
  events	
  
across	
  bounded	
  contexts
Events	
  have	
  many	
  benefits	
  but	
  also	
  some	
  downsides	
  -­‐
they	
  are	
  an	
  important	
  tool	
  in	
  your	
  toolbox.

Contenu connexe

Tendances

Gartner event mesh solace - phil scanlon - gold coast
Gartner event mesh   solace - phil scanlon - gold coastGartner event mesh   solace - phil scanlon - gold coast
Gartner event mesh solace - phil scanlon - gold coastPhil Scanlon
 
Using Kafka in Your Organization with Real-Time User Insights for a Customer ...
Using Kafka in Your Organization with Real-Time User Insights for a Customer ...Using Kafka in Your Organization with Real-Time User Insights for a Customer ...
Using Kafka in Your Organization with Real-Time User Insights for a Customer ...confluent
 
WJAX 2013 Slides online: Big Data beyond Apache Hadoop - How to integrate ALL...
WJAX 2013 Slides online: Big Data beyond Apache Hadoop - How to integrate ALL...WJAX 2013 Slides online: Big Data beyond Apache Hadoop - How to integrate ALL...
WJAX 2013 Slides online: Big Data beyond Apache Hadoop - How to integrate ALL...Kai Wähner
 
Data center world 2010 10 5 10
Data center world 2010   10 5 10Data center world 2010   10 5 10
Data center world 2010 10 5 10David Resnic
 
Event-driven Business: How Leading Companies Are Adopting Streaming Strategies
Event-driven Business: How Leading Companies Are Adopting Streaming StrategiesEvent-driven Business: How Leading Companies Are Adopting Streaming Strategies
Event-driven Business: How Leading Companies Are Adopting Streaming Strategiesconfluent
 
Fast Data for Competitive Advantage: 4 Steps to Expand your Window of Opportu...
Fast Data for Competitive Advantage: 4 Steps to Expand your Window of Opportu...Fast Data for Competitive Advantage: 4 Steps to Expand your Window of Opportu...
Fast Data for Competitive Advantage: 4 Steps to Expand your Window of Opportu...VoltDB
 
Analytics Patterns for Your Digital Enterprise
Analytics Patterns for Your Digital EnterpriseAnalytics Patterns for Your Digital Enterprise
Analytics Patterns for Your Digital EnterpriseSriskandarajah Suhothayan
 
Analyzing Billions of Data Rows with Alteryx, Amazon Redshift, and Tableau
Analyzing Billions of Data Rows with Alteryx, Amazon Redshift, and TableauAnalyzing Billions of Data Rows with Alteryx, Amazon Redshift, and Tableau
Analyzing Billions of Data Rows with Alteryx, Amazon Redshift, and TableauDATAVERSITY
 
The Streaming Assessment – An Introduction
The Streaming Assessment – An IntroductionThe Streaming Assessment – An Introduction
The Streaming Assessment – An Introductionconfluent
 
Lighning Talk: Event-Driven architecture for microservices
Lighning Talk: Event-Driven architecture for microservicesLighning Talk: Event-Driven architecture for microservices
Lighning Talk: Event-Driven architecture for microservicesMartins Sipenko
 
WSO2Con USA 2017: Driving Insights for Your Digital Business With Analytics
WSO2Con USA 2017: Driving Insights for Your Digital Business With AnalyticsWSO2Con USA 2017: Driving Insights for Your Digital Business With Analytics
WSO2Con USA 2017: Driving Insights for Your Digital Business With AnalyticsWSO2
 
Hybrid & Global Kafka Architecture
Hybrid & Global Kafka ArchitectureHybrid & Global Kafka Architecture
Hybrid & Global Kafka Architectureconfluent
 
Event-Driven Microservices with Apache Kafka, Kafka Streams and KSQL
Event-Driven Microservices with Apache Kafka, Kafka Streams and KSQLEvent-Driven Microservices with Apache Kafka, Kafka Streams and KSQL
Event-Driven Microservices with Apache Kafka, Kafka Streams and KSQLKai Wähner
 
Event Streaming in Retail with Apache Kafka
Event Streaming in Retail with Apache KafkaEvent Streaming in Retail with Apache Kafka
Event Streaming in Retail with Apache KafkaKai Wähner
 
Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...
Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...
Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...Kai Wähner
 
Confluent & MongoDB APAC Lunch & Learn
Confluent & MongoDB APAC Lunch & LearnConfluent & MongoDB APAC Lunch & Learn
Confluent & MongoDB APAC Lunch & Learnconfluent
 
Apache Kafka Landscape for Automotive and Manufacturing
Apache Kafka Landscape for Automotive and ManufacturingApache Kafka Landscape for Automotive and Manufacturing
Apache Kafka Landscape for Automotive and ManufacturingKai Wähner
 
Data reply sneak peek: real time decision engines
Data reply sneak peek:  real time decision enginesData reply sneak peek:  real time decision engines
Data reply sneak peek: real time decision enginesconfluent
 
Connecting Apache Kafka to Cash
Connecting Apache Kafka to CashConnecting Apache Kafka to Cash
Connecting Apache Kafka to Cashconfluent
 
Apache Kafka for Automotive Industry, Mobility Services & Smart City
Apache Kafka for Automotive Industry, Mobility Services & Smart CityApache Kafka for Automotive Industry, Mobility Services & Smart City
Apache Kafka for Automotive Industry, Mobility Services & Smart CityKai Wähner
 

Tendances (20)

Gartner event mesh solace - phil scanlon - gold coast
Gartner event mesh   solace - phil scanlon - gold coastGartner event mesh   solace - phil scanlon - gold coast
Gartner event mesh solace - phil scanlon - gold coast
 
Using Kafka in Your Organization with Real-Time User Insights for a Customer ...
Using Kafka in Your Organization with Real-Time User Insights for a Customer ...Using Kafka in Your Organization with Real-Time User Insights for a Customer ...
Using Kafka in Your Organization with Real-Time User Insights for a Customer ...
 
WJAX 2013 Slides online: Big Data beyond Apache Hadoop - How to integrate ALL...
WJAX 2013 Slides online: Big Data beyond Apache Hadoop - How to integrate ALL...WJAX 2013 Slides online: Big Data beyond Apache Hadoop - How to integrate ALL...
WJAX 2013 Slides online: Big Data beyond Apache Hadoop - How to integrate ALL...
 
Data center world 2010 10 5 10
Data center world 2010   10 5 10Data center world 2010   10 5 10
Data center world 2010 10 5 10
 
Event-driven Business: How Leading Companies Are Adopting Streaming Strategies
Event-driven Business: How Leading Companies Are Adopting Streaming StrategiesEvent-driven Business: How Leading Companies Are Adopting Streaming Strategies
Event-driven Business: How Leading Companies Are Adopting Streaming Strategies
 
Fast Data for Competitive Advantage: 4 Steps to Expand your Window of Opportu...
Fast Data for Competitive Advantage: 4 Steps to Expand your Window of Opportu...Fast Data for Competitive Advantage: 4 Steps to Expand your Window of Opportu...
Fast Data for Competitive Advantage: 4 Steps to Expand your Window of Opportu...
 
Analytics Patterns for Your Digital Enterprise
Analytics Patterns for Your Digital EnterpriseAnalytics Patterns for Your Digital Enterprise
Analytics Patterns for Your Digital Enterprise
 
Analyzing Billions of Data Rows with Alteryx, Amazon Redshift, and Tableau
Analyzing Billions of Data Rows with Alteryx, Amazon Redshift, and TableauAnalyzing Billions of Data Rows with Alteryx, Amazon Redshift, and Tableau
Analyzing Billions of Data Rows with Alteryx, Amazon Redshift, and Tableau
 
The Streaming Assessment – An Introduction
The Streaming Assessment – An IntroductionThe Streaming Assessment – An Introduction
The Streaming Assessment – An Introduction
 
Lighning Talk: Event-Driven architecture for microservices
Lighning Talk: Event-Driven architecture for microservicesLighning Talk: Event-Driven architecture for microservices
Lighning Talk: Event-Driven architecture for microservices
 
WSO2Con USA 2017: Driving Insights for Your Digital Business With Analytics
WSO2Con USA 2017: Driving Insights for Your Digital Business With AnalyticsWSO2Con USA 2017: Driving Insights for Your Digital Business With Analytics
WSO2Con USA 2017: Driving Insights for Your Digital Business With Analytics
 
Hybrid & Global Kafka Architecture
Hybrid & Global Kafka ArchitectureHybrid & Global Kafka Architecture
Hybrid & Global Kafka Architecture
 
Event-Driven Microservices with Apache Kafka, Kafka Streams and KSQL
Event-Driven Microservices with Apache Kafka, Kafka Streams and KSQLEvent-Driven Microservices with Apache Kafka, Kafka Streams and KSQL
Event-Driven Microservices with Apache Kafka, Kafka Streams and KSQL
 
Event Streaming in Retail with Apache Kafka
Event Streaming in Retail with Apache KafkaEvent Streaming in Retail with Apache Kafka
Event Streaming in Retail with Apache Kafka
 
Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...
Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...
Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...
 
Confluent & MongoDB APAC Lunch & Learn
Confluent & MongoDB APAC Lunch & LearnConfluent & MongoDB APAC Lunch & Learn
Confluent & MongoDB APAC Lunch & Learn
 
Apache Kafka Landscape for Automotive and Manufacturing
Apache Kafka Landscape for Automotive and ManufacturingApache Kafka Landscape for Automotive and Manufacturing
Apache Kafka Landscape for Automotive and Manufacturing
 
Data reply sneak peek: real time decision engines
Data reply sneak peek:  real time decision enginesData reply sneak peek:  real time decision engines
Data reply sneak peek: real time decision engines
 
Connecting Apache Kafka to Cash
Connecting Apache Kafka to CashConnecting Apache Kafka to Cash
Connecting Apache Kafka to Cash
 
Apache Kafka for Automotive Industry, Mobility Services & Smart City
Apache Kafka for Automotive Industry, Mobility Services & Smart CityApache Kafka for Automotive Industry, Mobility Services & Smart City
Apache Kafka for Automotive Industry, Mobility Services & Smart City
 

En vedette

Concevoir et déployer vos applications a base de microservices sur Cloud Foundry
Concevoir et déployer vos applications a base de microservices sur Cloud FoundryConcevoir et déployer vos applications a base de microservices sur Cloud Foundry
Concevoir et déployer vos applications a base de microservices sur Cloud FoundryVMware Tanzu
 
What's new in Pivotal Cloud Foundry 1.6
What's new in Pivotal Cloud Foundry 1.6What's new in Pivotal Cloud Foundry 1.6
What's new in Pivotal Cloud Foundry 1.6dektlong
 
Breaking the Monolith
Breaking the MonolithBreaking the Monolith
Breaking the MonolithVMware Tanzu
 
Building microservices with Scala, functional domain models and Spring Boot
Building microservices with Scala, functional domain models and Spring BootBuilding microservices with Scala, functional domain models and Spring Boot
Building microservices with Scala, functional domain models and Spring BootChris Richardson
 
The Journey from Monolith to Microservices: a Guided Adventure
The Journey from Monolith to Microservices: a Guided AdventureThe Journey from Monolith to Microservices: a Guided Adventure
The Journey from Monolith to Microservices: a Guided AdventureVMware Tanzu
 
The Cloud Native Journey
The Cloud Native JourneyThe Cloud Native Journey
The Cloud Native JourneyVMware Tanzu
 

En vedette (7)

Concevoir et déployer vos applications a base de microservices sur Cloud Foundry
Concevoir et déployer vos applications a base de microservices sur Cloud FoundryConcevoir et déployer vos applications a base de microservices sur Cloud Foundry
Concevoir et déployer vos applications a base de microservices sur Cloud Foundry
 
What's new in Pivotal Cloud Foundry 1.6
What's new in Pivotal Cloud Foundry 1.6What's new in Pivotal Cloud Foundry 1.6
What's new in Pivotal Cloud Foundry 1.6
 
Neuro4j Workflow Overview
Neuro4j Workflow OverviewNeuro4j Workflow Overview
Neuro4j Workflow Overview
 
Breaking the Monolith
Breaking the MonolithBreaking the Monolith
Breaking the Monolith
 
Building microservices with Scala, functional domain models and Spring Boot
Building microservices with Scala, functional domain models and Spring BootBuilding microservices with Scala, functional domain models and Spring Boot
Building microservices with Scala, functional domain models and Spring Boot
 
The Journey from Monolith to Microservices: a Guided Adventure
The Journey from Monolith to Microservices: a Guided AdventureThe Journey from Monolith to Microservices: a Guided Adventure
The Journey from Monolith to Microservices: a Guided Adventure
 
The Cloud Native Journey
The Cloud Native JourneyThe Cloud Native Journey
The Cloud Native Journey
 

Similaire à Events & Microservices Architecture: How Asynchronous Communication Can Reduce Coupling

Events & Microservices
Events & MicroservicesEvents & Microservices
Events & MicroservicesYamen Sader
 
Moving To MicroServices
Moving To MicroServicesMoving To MicroServices
Moving To MicroServicesDavid Walker
 
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
 
Introduction to Stream Processing
Introduction to Stream ProcessingIntroduction to Stream Processing
Introduction to Stream ProcessingGuido Schmutz
 
Stream Processing in Action
Stream Processing in ActionStream Processing in Action
Stream Processing in ActionWSO2
 
Understanding event data
Understanding event dataUnderstanding event data
Understanding event datayalisassoon
 
WebAction In-Memory Computing Summit 2015
WebAction In-Memory Computing Summit 2015WebAction In-Memory Computing Summit 2015
WebAction In-Memory Computing Summit 2015WebAction
 
Smart Process Automation - Connected Brains 2018
Smart Process Automation - Connected Brains 2018Smart Process Automation - Connected Brains 2018
Smart Process Automation - Connected Brains 2018LoQutus
 
Kafka-and-event-driven-architecture-OGYatra20.ppt
Kafka-and-event-driven-architecture-OGYatra20.pptKafka-and-event-driven-architecture-OGYatra20.ppt
Kafka-and-event-driven-architecture-OGYatra20.pptInam Bukhary
 
BigData & CDN - OOP2011 (Pavlo Baron)
BigData & CDN - OOP2011 (Pavlo Baron)BigData & CDN - OOP2011 (Pavlo Baron)
BigData & CDN - OOP2011 (Pavlo Baron)Pavlo Baron
 
ThingMonk 2016 - Concursus Event sourcing for the IOT By Tareq Abedrabbo & Do...
ThingMonk 2016 - Concursus Event sourcing for the IOT By Tareq Abedrabbo & Do...ThingMonk 2016 - Concursus Event sourcing for the IOT By Tareq Abedrabbo & Do...
ThingMonk 2016 - Concursus Event sourcing for the IOT By Tareq Abedrabbo & Do...OpenCredo
 
Kalix: Tackling the The Cloud to Edge Continuum
Kalix: Tackling the The Cloud to Edge ContinuumKalix: Tackling the The Cloud to Edge Continuum
Kalix: Tackling the The Cloud to Edge ContinuumJonas Bonér
 
How to Realize the Benefits of Cloud Services Brokerage
How to Realize the Benefits of Cloud Services BrokerageHow to Realize the Benefits of Cloud Services Brokerage
How to Realize the Benefits of Cloud Services Brokeragejamcracker4677
 
Resource-Oriented Architecture (ROA)
Resource-Oriented Architecture (ROA)Resource-Oriented Architecture (ROA)
Resource-Oriented Architecture (ROA)WSO2
 
Extending your applications to the edge with CDNs
Extending your applications to the edge with CDNsExtending your applications to the edge with CDNs
Extending your applications to the edge with CDNsSergeyChernyshev
 
Kafka and event driven architecture -og yatra20
Kafka and event driven architecture -og yatra20Kafka and event driven architecture -og yatra20
Kafka and event driven architecture -og yatra20Vinay Kumar
 
Kafka and event driven architecture -apacoug20
Kafka and event driven architecture -apacoug20Kafka and event driven architecture -apacoug20
Kafka and event driven architecture -apacoug20Vinay Kumar
 
Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...
Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...
Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...confluent
 
Responsive Innovation in a Local Context
Responsive Innovation in a Local ContextResponsive Innovation in a Local Context
Responsive Innovation in a Local ContextPaul Walk
 
Message Driven and Event Sourcing
Message Driven and Event SourcingMessage Driven and Event Sourcing
Message Driven and Event SourcingPaolo Castagna
 

Similaire à Events & Microservices Architecture: How Asynchronous Communication Can Reduce Coupling (20)

Events & Microservices
Events & MicroservicesEvents & Microservices
Events & Microservices
 
Moving To MicroServices
Moving To MicroServicesMoving To MicroServices
Moving To MicroServices
 
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...
 
Introduction to Stream Processing
Introduction to Stream ProcessingIntroduction to Stream Processing
Introduction to Stream Processing
 
Stream Processing in Action
Stream Processing in ActionStream Processing in Action
Stream Processing in Action
 
Understanding event data
Understanding event dataUnderstanding event data
Understanding event data
 
WebAction In-Memory Computing Summit 2015
WebAction In-Memory Computing Summit 2015WebAction In-Memory Computing Summit 2015
WebAction In-Memory Computing Summit 2015
 
Smart Process Automation - Connected Brains 2018
Smart Process Automation - Connected Brains 2018Smart Process Automation - Connected Brains 2018
Smart Process Automation - Connected Brains 2018
 
Kafka-and-event-driven-architecture-OGYatra20.ppt
Kafka-and-event-driven-architecture-OGYatra20.pptKafka-and-event-driven-architecture-OGYatra20.ppt
Kafka-and-event-driven-architecture-OGYatra20.ppt
 
BigData & CDN - OOP2011 (Pavlo Baron)
BigData & CDN - OOP2011 (Pavlo Baron)BigData & CDN - OOP2011 (Pavlo Baron)
BigData & CDN - OOP2011 (Pavlo Baron)
 
ThingMonk 2016 - Concursus Event sourcing for the IOT By Tareq Abedrabbo & Do...
ThingMonk 2016 - Concursus Event sourcing for the IOT By Tareq Abedrabbo & Do...ThingMonk 2016 - Concursus Event sourcing for the IOT By Tareq Abedrabbo & Do...
ThingMonk 2016 - Concursus Event sourcing for the IOT By Tareq Abedrabbo & Do...
 
Kalix: Tackling the The Cloud to Edge Continuum
Kalix: Tackling the The Cloud to Edge ContinuumKalix: Tackling the The Cloud to Edge Continuum
Kalix: Tackling the The Cloud to Edge Continuum
 
How to Realize the Benefits of Cloud Services Brokerage
How to Realize the Benefits of Cloud Services BrokerageHow to Realize the Benefits of Cloud Services Brokerage
How to Realize the Benefits of Cloud Services Brokerage
 
Resource-Oriented Architecture (ROA)
Resource-Oriented Architecture (ROA)Resource-Oriented Architecture (ROA)
Resource-Oriented Architecture (ROA)
 
Extending your applications to the edge with CDNs
Extending your applications to the edge with CDNsExtending your applications to the edge with CDNs
Extending your applications to the edge with CDNs
 
Kafka and event driven architecture -og yatra20
Kafka and event driven architecture -og yatra20Kafka and event driven architecture -og yatra20
Kafka and event driven architecture -og yatra20
 
Kafka and event driven architecture -apacoug20
Kafka and event driven architecture -apacoug20Kafka and event driven architecture -apacoug20
Kafka and event driven architecture -apacoug20
 
Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...
Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...
Event Driven Architecture with a RESTful Microservices Architecture (Kyle Ben...
 
Responsive Innovation in a Local Context
Responsive Innovation in a Local ContextResponsive Innovation in a Local Context
Responsive Innovation in a Local Context
 
Message Driven and Event Sourcing
Message Driven and Event SourcingMessage Driven and Event Sourcing
Message Driven and Event Sourcing
 

Dernier

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Dernier (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

Events & Microservices Architecture: How Asynchronous Communication Can Reduce Coupling

  • 1. Events & Microservices Saul  Caganoff,  CTO  Sixtree saul@sixtree.com.au @scaganoff
  • 2. Introduction • Asynchrony  is  considered  a  microservice   characteristic – But  not  often  discussed • In  the  top  20  Google  results – 7  mentioned  async/choreography  or  events – 3  of  those  by  Chris  Richardson  or  Martin  Fowler • Mostly  mentioned  in  passing • Honourable  Mentions: – http://www.infoq.com/articles/microservices-­‐intro – http://highscalability.com/blog/2014/4/8/microservices-­‐not-­‐a-­‐free-­‐ lunch.html
  • 4. Bounded Contexts Finance Sales Fulfilment Product Online  bookstore  is   the  “Hello  World”  of   enterprise  systems http://maribyrnong.com.au
  • 7. Fulfilment Context Book ISBN Title Customer Name Receipt Order  Number Sub-­‐total GST Total Address Street  Number Street  Name Suburb Postcode Courier Depot Location Driver Shipment Dispatch  Time ETA Location
  • 9. Coupling & Cohesion • Cohesion – how  well  a  subsystem  forms  a   uniting  whole – How  well  a  bounded  context  does  its  job • Coupling – the  propensity  for  change  in  one   part  of  a  system  to  disrupt  another – how  badly  “stuff”  leaks  across  the  boundaries • Coupling  is  evil  – it  sneaks  into  solutions  in  all   kinds  of  insidious  ways
  • 10.
  • 11. Coupling & Cohesion • Microservices strive to  eliminate  coupling • Insidious  sources  of  coupling – Shared  databases – Single  Common  Data  Model  (vs  bounded  contexts) – DRY  – shared  code – APIs  generated  from  code – Autogenerated client  SDKs – Projects  – funding  and  scope – Assumptions  about  business  processes – Organizational  structure
  • 12. Business Processes • End-­‐to-­‐end  business  processes  require   coordination  across  bounded  contexts Finance Sales Ful-­‐ filment Product
  • 13. Business Processes • Browse  the  inventory • Create  order • Enter  Shipping  Details • Quote  shipping  charge • Make  the  payment • Update  inventory • Create  Shipment • Pick  &  Pack • Courier • Accept  delivery GET  /products POST  /order PUT  /order/:id/address GET  /3pl/charges?zip=… POST  /finance/payment?order= POST  /products POST  /3pl/shipment GET  /3pl/shipment/:id GET  /3pl/shipment/:id/address PUT  /3pl/shipment/:id?status=
  • 14. Business Processes • Orchestration   – Centralized  coordination – E.g.  the  user-­‐agent,  BPM  engine,  service  facade – the  “god”  object • Hypermedia – HATEOAS – But  what  about  at  the  edges? – How  much  should  one  BC  know  about  another  BC? “microservices architecture  will  never  be  SOA  done  right  unless  it  means  building   hypermedia  systems  of  microservices”  – Jason  Bloomberg http://intellyx.com/2015/07/20/are-­‐microservices-­‐soa-­‐done-­‐right/
  • 15. Some Perspective 0 2 4 6 8 10 12 DB  Triggers Monolith Orchestration Hypermedia EDA Coupling
  • 16. Data Synchronization • How  to  handle  data  “owned”  by  multiple   domains – Glibness: “don’t”  have  multiple  data  owners – …in  reality  it  is  impossible  to  eliminate – …especially  if  legacy  or  COTS  systems  involved. • Some  data  synchronization  is  naturally   conveyed  by  the  business  process • …some  is  not.
  • 17. Choreography • Use  events  to  coordinate  activity  across  bounded   contexts • Publishers  &  Subscribers  are  highly  decoupled – Event  subscribers  can  come  &  go  minimal  or  no  code   or  configuration  changes • Publishers  &  Subscribers  are  more  resilient  to   change  – either  planned  or  unplanned – E.g.  events  redelivered  in  the  event  of  subscriber   failure  – either  to  the  restored  subscriber,  or  a   replacement
  • 18. Choreography • But  trade-­‐offs • Asynchronous  events  lie  at  the  heart  of  some  of   the  microservices challenges – Centralised  orchestration  is  harder  to  change,  but   easier  to  control/monitor – Event-­‐based  choreography  is  easier  to  change  but   harder  to  control/monitor • Distributed  logging/monitoring  systems  are   needed  to  provide  a  view  into  asynchronous   interactions
  • 19. Coordination • Think  about  hypermedia  inside  boundaries • Events  outside  the  boundaries Finance Sales Ful-­‐ filment Product
  • 21. Commands & Events • Duality  between  commands  &  events – Commands  cause  state  transitions – Events  reflect  state  transitions • An  external  observer  can  infer  the  state  of  a   resource  from  its  event-­‐stream – This  is  the  essence  of  event-­‐sourcing  &  CQRS
  • 22. State Modelling Empty Cart Full Cart Quoted Paid POST  /cart PUT  /cart/:id {  book:  …  } PUT  /cart/:id {  book:  …  } DELETE  /cart/:id/books/:id PUT  /cart/:id {  address:  …  } POST  /payments {  cart:  …,  card:  {…}} Commands  (HATEOAS) {create:  {  cart:  …  }  …  } {add:  {  cart:  …,  book:  {…}}  ..} {add:  {  cart:  …,  book:  {…}}  ..} {del:  {  cart:  …,  book:  {…}}  ..} {quoted:  {  cart:  …  }  …  } {paid:  {  cart:  …  }  …  } Events  (EATNOAS)
  • 24. Event Structure • Immutable  structures • Typical  properties – Timestamp – Source – Entity  URI – Action  (state  transition) • The  MVP  is  to  notify  that  a  resource  has   changed  and  allow  subscribers  to  pull  the   update  if  needed.
  • 25. Concurrency • Race  Conditions • The  importance  of  order • Single  Master  vs  Multi-­‐Master • Deltas  vs  Copies • Action  indicators • CRDTs  – conflict-­‐free  replicated  data  types • …think  in  terms  of  events  rather  than  copies
  • 27. Syndication • Service  exposes  an  RSS/atom  feed • Consumers  do  all  the  hard  work: – Subscription – State  Management  (where  am  I  up  to?) – Retries • Positives – Very  easy…well-­‐known  pattern – Web-­‐scale • Negatives – Polling – High  latency
  • 28. Web Hooks • Service  POSTs  events  to  subscribers • Publishers  do  all  the  hard  work: – Manage  subscribers – Managed  guaranteed  delivery/  retries • Positives – Not  polling,  relatively  lower  latency • Negatives – Subscription  management  &  guaranteed  delivery   must  be  done  yourself…can  be  tricky.
  • 29. Message Queues • Events  published  to  queues/topics – E.g JMS,  AMQP,  ZMQ,  SQS/SNS,  IronMQ • Positives – Mature,  well-­‐known  technologies – Good  open-­‐source  implementations  available – Competing  consumer  pattern • Negatives – Extra  infrastructure – Reliability  depends  on  reliable  file-­‐systems   • SANs,  Distributed  file-­‐lock  managers
  • 30. Apache Kafka • Distributed  log • Similar  model  to  syndication – Single  node  shares  data  by  writing  to  logfiles – Consumers  tail  the  logs • Consumers  control  their  position  in  the  log • Low  latency • Reliability  handled  at  the  application  layer – whether  Zookeeper  is  less  burdensome  than  clustered   file  system  is  up  to  you
  • 31. Event Processing • Simple  events  are  very  useful  for  data   synchronization  or  process  coordination • Continuum  of  complexity • Some  tools:  Drools,  Riemann.io,  Apache  Storm • This  is  a  whole  ‘nother topic Cardinality State Tools Single  event Simple Event  processor Multiple  events/stream Simple Stream  processor Multiple  events/stream Complex  /  Rules Complex  Event  Processor
  • 32. Wrap-Up • Bounded  contexts  are  important – they  promote  cohesion  and  reduce  coupling • You  need  to  decide  how  to  coordinate  data  &   processes  across  boundaries – Orchestration  (relatively  higher  coupling) – Hypermedia  (couples  across  boundaries) – Events • Prefer  Hypermedia  within  bounded  contexts  &  events   across  bounded  contexts Events  have  many  benefits  but  also  some  downsides  -­‐ they  are  an  important  tool  in  your  toolbox.