essay about event driven architecture

43
Essay about Event-Driven Architecture Paulo Victor Gomes @pvgomes Twitter @Pv_fusion CTO at Natue - www.natue.com.br Voucher: PHPEXPERIENCE2017

Upload: paulo-victor-gomes

Post on 10-Apr-2017

91 views

Category:

Technology


6 download

TRANSCRIPT

Page 1: Essay about event driven architecture

Essay about Event-Driven Architecture

Paulo Victor Gomes @pvgomesTwitter @Pv_fusion

CTO at Natue - www.natue.com.brVoucher: PHPEXPERIENCE2017

Page 2: Essay about event driven architecture

Case - E-CommerceIn this essay we will use the e-commerce as an example

Shop- Customer- Catalog- Cart- Checkout- CMS- WMS- Freight….

Page 3: Essay about event driven architecture

Monolithic

Customer

Catalog

Cart

Checkout

Shop

Customer

CartCatalog

Catalog

Cart

CMS

CMS

Url manager / SEO

Checkout

Newsletter

Newsletter

Newsletter

Freight

Freight

Freight

FreightWMS

Page 4: Essay about event driven architecture

Monolithic

Customer

Catalog

Cart

Checkout

Shop

Customer

CartCatalog

Catalog

Cart

CMS

CMS

Url manager / SEO

Checkout

Newsletter

Newsletter

Newsletter

Freight

Freight

Freight

FreightWMS

This does not scale very well

It is very difficult to make changes

Page 5: Essay about event driven architecture

Service Oriented Architecture (SOA) is the solutionWe can divide the problem domain into separate systems

Page 6: Essay about event driven architecture

Beginning SOA’s approach

Customer

Catalog

Cart

Checkout

Shop

Customer

CartCatalog

Catalog

Cart

CMS

CMS

Url manager / SEO

Checkout

Newsletter

Freight

Freight

Freight

Freight

WMS

Page 7: Essay about event driven architecture

Beginning SOA’s approach

Customer

Catalog

Cart

Checkout

Shop

Customer

CartCatalog

Catalog

Cart

CMS

CMS

Url manager / SEO

Checkout

Newsletter

Freight

Freight

Freight

Freight

WMS

Page 8: Essay about event driven architecture

Keep moving forward SOA’s approach...

Customer

Catalog

Cart

Checkout

Shop

Customer

CartCatalog

Catalog

Cart

CMS

Url manager / SEO

Checkout

Newsletter

Freight

Freight

WMS

Page 9: Essay about event driven architecture

Keep moving forward SOA’s approach...

Catalog

Cart

Checkout

Shop

Customer

CartCatalog

Catalog

Cart

CMS

Url manager / SEO

Checkout

Newsletter

Freight

WMS

Page 10: Essay about event driven architecture

Keep moving forward SOA’s approach...

Catalog

Cart

Shop

Customer

CartCatalog

Catalog

Cart

CMS

Url manager / SEO

Checkout

Newsletter

Freight

WMS

Page 11: Essay about event driven architecture

Sometimes it’s not just create a service

Checkout

Shop checkout page Order management- Purchase Order- Order Acceptance- Order Processing- Stock availability- Sales Return

Page 12: Essay about event driven architecture

Keep moving forward SOA’s approach...

Catalog

Cart

Shop

Customer

CartCatalog

Catalog

Cart

CMS

Url manager / SEO

Checkout

Newsletter

Freight

WMS

Checkout-SPAOrder

Management

Page 13: Essay about event driven architecture

Keep moving forward SOA’s approach...Catalog

CartShop

Customer

Cart

Cart

CMS

Url manager / SEO

Checkout

Newsletter

Freight

WMS

Checkout-SPAOrder

Management

Search API

Page 14: Essay about event driven architecture

Bye Bye Monolithic

Catalog

Shop

Customer

Cart

CMS

Url manager / SEO

Newsletter

Freight

WMS

Checkout-SPAOrder

ManagementSearch

APIStock API

Page 15: Essay about event driven architecture

Bye Bye Monolithic

Catalog

Shop

Customer

Cart

CMS

Url manager / SEO

Newsletter

Freight

WMS

Checkout-SPAOrder

ManagementSearch

APIStock API

Page 16: Essay about event driven architecture

Bye Bye Monolithic

Catalog

Shop

Customer

Cart

CMS

Url manager / SEO

Newsletter

Freight

WMS

Checkout-SPAOrder

ManagementSearch

APIStock API

A lot of point to point integration

Page 17: Essay about event driven architecture

Introduction of Event-Driven Architecture (EDA)Also known as message-driven architecture, is a software architecture pattern

promoting the production, detection, consumption of, and reaction to events

An event can be defined as "a significant change in state"

K. Mani Chandy Event-Driven Applications

We make a change to the state of a system, we record that state

change as an event, and we can confidently rebuild the system

state by reprocessing the events at any time in the future...

Martin Fowler

Page 18: Essay about event driven architecture

Events

Page 19: Essay about event driven architecture

EDA Main Goal

EDA is not just about agnostic services, is more about reacting through the Events

Page 20: Essay about event driven architecture

EDA - Event reactionsProduct flow example

Page 21: Essay about event driven architecture

BackOffice

EDA - Event reactionsProduct flow example

Page 22: Essay about event driven architecture

BackOffice Catalog+POST+PUT+PATCH+DELETE

Product

EDA - Event reactionsProduct flow example

Page 23: Essay about event driven architecture

BackOffice Catalog+POST+PUT+PATCH+DELETE

Product SearchProduct+POST+PUT+PATCH+DELETE

EDA - Event reactionsProduct flow example

Page 24: Essay about event driven architecture

BackOffice Catalog+POST+PUT+PATCH+DELETE

Product SearchProduct+POST+PUT+PATCH+DELETE

FeedProduct+POST+PUT+PATCH+DELETE

EDA - Event reactionsProduct flow example

Page 25: Essay about event driven architecture

EDA - Event reactionsProduct flow example

BackOffice Catalog+POST+PUT+PATCH+DELETE

Product SearchProduct+POST+PUT+PATCH+DELETE

FeedProduct+POST+PUT+PATCH+DELETE

MarketPlace+POST+PUT+PATCH+DELETE

Product

Page 26: Essay about event driven architecture

EDA - Event reactions

- Product flow example

BackOffice Catalog+POST+PUT+PATCH+DELETE

Product SearchProduct+POST+PUT+PATCH+DELETE

FeedProduct+POST+PUT+PATCH+DELETE

MarketPlace+POST+PUT+PATCH+DELETE

Product

Catalog must know all services, e-commerce flow, it isn't agnostic

A lot of point to point integration

Page 27: Essay about event driven architecture

EDA - Event reactions

- Product flow example

BackOffice Catalog+POST+PUT+PATCH+DELETE

Product SearchProduct+POST+PUT+PATCH+DELETE

FeedProduct+POST+PUT+PATCH+DELETE

MarketPlace+POST+PUT+PATCH+DELETE

Product

Let's try another approach

Page 28: Essay about event driven architecture

EDA - Event reactionsAnother approach

BackOffice Catalog+POST+PUT+PATCH+DELETE

Product SearchProduct

Feed

MarketPlace+GETProduct

+GET

+GETProduct

Page 29: Essay about event driven architecture

EDA - Event reactionsAnother approach

BackOffice Catalog+POST+PUT+PATCH+DELETE

Product SearchProduct

Feed

MarketPlace+GETProduct

+GET

+GETProduct

Page 30: Essay about event driven architecture

EDA - Event reactions

- Product flow example

BackOffice Catalog+POST+PUT+PATCH+DELETE

Product SearchProduct+POST+PUT+PATCH+DELETE

FeedProduct+POST+PUT+PATCH+DELETE

MarketPlace+POST+PUT+PATCH+DELETE

Product

Page 31: Essay about event driven architecture

EDA - Event reactions

- Product flow example

BackOffice Catalog+POST+PUT+PATCH+DELETE

Product SearchProduct+POST+PUT+PATCH+DELETE

FeedProduct+POST+PUT+PATCH+DELETE

MarketPlace+POST+PUT+PATCH+DELETE

ProductWhen will our services call Catalog?

Page 32: Essay about event driven architecture

EDA - Event reactionsAnother approach

BackOffice Catalog+POST+PUT+PATCH+DELETE

Product SearchProduct

Feed

MarketPlace+GETProduct

+GET

+GETProduct

Page 33: Essay about event driven architecture

EDA - Event reactions

- Product flow example

BackOffice Catalog+POST+PUT+PATCH+DELETE

Product SearchProduct+POST+PUT+PATCH+DELETE

FeedProduct+POST+PUT+PATCH+DELETE

MarketPlace+POST+PUT+PATCH+DELETE

ProductPerhaps a cronjob?

Page 34: Essay about event driven architecture

EDA - Event reactionsEDA approach

BackOffice Catalog+POST+PUT+PATCH+DELETE

Product Search

Feed

MarketPlace

?

Page 35: Essay about event driven architecture

EDA - Event reactionsEDA approach

BackOffice Catalog+POST+PUT+PATCH+DELETE

Product Search

Feed

MarketPlaceCentral Message Bus

Product CreatedProduct UpdatedProduct Deleted

Page 36: Essay about event driven architecture

EDA - Event reactionsEDA approach

BackOffice Catalog+POST+PUT+PATCH+DELETE

Product Search

Feed

MarketPlaceCentral Message Bus

Product CreatedProduct UpdatedProduct Deleted

Events

Page 37: Essay about event driven architecture

EDA - Event reactionsEDA approach

BackOffice Catalog+POST+PUT+PATCH+DELETE

Product Search

Feed

MarketPlaceCentral Message Bus

Product CreatedProduct UpdatedProduct Deleted

Central Message Handler

Page 38: Essay about event driven architecture

EDA - Event reactionsEDA approach

BackOffice Catalog+POST+PUT+PATCH+DELETE

Product Search

Feed

MarketPlaceCentral Message Bus

Product CreatedProduct UpdatedProduct Deleted

Central Message Handler

Page 39: Essay about event driven architecture

EDA - Event reactionsEDA approach

BackOffice Catalog

+POST+PUT+PATCH+DELETE

Search

Feed

MarketPlaceCentral Message Bus

Central Message HandlerMarketPlace Product Created

Page 40: Essay about event driven architecture

EDA - Event reactionsEDA approach

BackOffice Catalog

+POST+PUT+PATCH+DELETE

Search

Feed

MarketPlaceCentral Message Bus

Central Message HandlerMarketPlace Product Created

Page 41: Essay about event driven architecture

The benefits- If error raises on service, the message remains in queue- It will be picked up later- Services don’t need to know about how to make updates to other

services- Adding more services is easy- Scales well

Page 42: Essay about event driven architecture

References

- Event Driven Architecture - K. Mani Chandy- What do you mean by “Event-Driven”? - Martin Fowler- Programming Without a Call Stack - Gregor Hohpe- Event Driven Architecture – The Basics - John Mathon

Page 43: Essay about event driven architecture

Thank youTwitter @Pv_Fusion

Slack @pvgomes

Github github.com/pvgomes

[email protected]

https://joind.in/talk/0525a