event-driven architecture

29
Event Driven Architecture A primer… @ShawnWallace

Upload: centric-consulting

Post on 08-Jan-2017

330 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Event-driven Architecture

Event Driven Architecture Aprimer…

@ShawnWallace

Page 2: Event-driven Architecture

The Great Debate…

MonolithFirst?

http://martinfowler.com/bliki/MonolithFirst.html

MicroservicesFirst?

http://martinfowler.com/articles/dont-start-monolith.html

Page 3: Event-driven Architecture

Monolithic

Invoicing Inventory

Logging

Profiles

Warehouse

Orders

Page 4: Event-driven Architecture

A problem with ‘Monolith First’

Aproductofouragileapproachtoourprojects…smallerfeaturesfinishedearlier.

ThegoalistodeploymoreoCen…thisishard.OnesoluDonistohavesmallerapplicaDons.

Page 5: Event-driven Architecture

Monolithic

Invoicing Inventory

Logging

Profiles

Warehouse

Orders

Page 6: Event-driven Architecture

SOA

Orders Invoicing Inventory

Logging Profiles Warehouse

Page 7: Event-driven Architecture

SOA

Orders Invoicing Inventory

Logging Profiles Warehouse

TightlyCoupled

Page 8: Event-driven Architecture

SOA with Enterprise Service Bus

Orders Invoicing Inventory

Logging Profiles Warehouse

STILLTightlyCoupled

EnterpriseServiceBus

Page 9: Event-driven Architecture

Event Driven Architecture

• AnEventisrepresentssomethingthathappensinadomain•  CustomerSubmitsOrder•  CustomerBilled•  PaymentReceived•  OrderReadyforShipment•  OrderShipped

• WhileEventsandtheirpayloadaredesignedattheenterprisesystemlevel,theirimplementaDonsareleCtothespecificsubsystems.

Page 10: Event-driven Architecture

Event Driven Architecture

• Nopoint-to-pointintegraDons•  Looselycoupled,highlyscalablesystems•  Looselycoupled,TEAMS•  Easiertotest•  Easiertochange•  TopologyagnosDc

Page 11: Event-driven Architecture

Loosely Coupled

Orders Invoicing Inventory

Logging Profiles ReporDng

EventBus

Page 12: Event-driven Architecture

Easy to Integrate New Systems

Orders Invoicing Inventory

Logging Profiles ReporDng

EventBus

NewSystem

Page 13: Event-driven Architecture

Easy to Test

Page 14: Event-driven Architecture

InventoryInventory

Inventory

Scales

Orders Invoicing Inventory

Logging Profiles ReporDng

EventBus

Page 15: Event-driven Architecture

The basic thesis of this article is that organizations which design systems (in the broad sense used here) are constrained to produce designs which are copies of the communication structures of these organizations. --- Melvin Conway

Page 16: Event-driven Architecture

Easily Modeled as a finite state diagram

Page 17: Event-driven Architecture

Other benefits

•  Easeof3rdpartyintegraDon•  ExisDngsystemscanbe‘wrapped’• Canbedeliberateaboutscaling•  Faulttolerant•  Eventmessagescanbeloggedand‘replayed’• CantestsubsystemsinisolaDon

Page 18: Event-driven Architecture

A Retail System

Sales Logger

Invoicing Shipping Warehouse

RabbitMQExchange

Page 19: Event-driven Architecture

A Retail System – PlaLorm AgnosMc

Sales Logger

Invoicing Shipping Warehouse

RabbitMQExchange

Page 20: Event-driven Architecture

Order Accepted Event is generated

Sales Logger

Invoicing Shipping Warehouse

RabbitMQExchange

Page 21: Event-driven Architecture

Customer Billed Event

Sales Logger

Invoicing Shipping Warehouse

RabbitMQExchange

Page 22: Event-driven Architecture

Order Ready for Shipment Event

Sales Logger

Invoicing Shipping Warehouse

RabbitMQExchange

Page 23: Event-driven Architecture

Order Shipped

Sales Logger

Invoicing Shipping Warehouse

RabbitMQExchange

Page 24: Event-driven Architecture

Logger Consumes EVERY Event

Sales Logger

Invoicing Shipping Warehouse

RabbitMQExchange

Page 25: Event-driven Architecture

Logger Consumes EVERY Event

Page 26: Event-driven Architecture
Page 27: Event-driven Architecture

For Further Reading

•  THISpresentaDon(andcode)onGitHubhXps://github.com/shawnewallace/choreographed_process•  StephanNorbergEDAhXp://www.infoq.com/presentaDons/Domain-Event-Driven-Architecture•  “ProgrammingWithoutaCallStack”hXp://www.enterpriseintegraDonpaXerns.com/docs/EDA.pdf•  “Event-DrivenArchitectureOverview”• hXp://www.omg.org/soa/Uploaded%20Docs/EDA/bda2-2-06cc.pdf

Page 28: Event-driven Architecture

Shawn WallaceWork:

[email protected]: @ShawnWallace

Blog: blog.shawnewallace.comhttp://www.about.me/shawnwallace

Page 29: Event-driven Architecture

•  Event-drivenarchitectureisaversaDleapproachtodesigningcomplexsoCwaresystems.ThesesystemstendtobeeasiertomodelforanorganizaDonasEDAembracesConway’sLawandcanoCenbemodeledasafinitestatemachine.Event-drivenarchitectureisnotanewconcept,butasmoreorganizaDonsembracemicroservices,thisapproachtosystemdesignhasbecomeappropriateinmoresituaDons.Inthistalkwe’ll:introduceevent-drivenarchitecture,talkaboutkeycomponents,lookatasampleimplementaDonofaretailsystem.