event driven architecture in practice

57
Event Driven Architecture in practice Domenico Musto @mimmozzo [email protected]

Upload: mimmozzo

Post on 02-Jul-2015

705 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Event driven architecture in practice

Event Driven Architecturein practice

Domenico Musto

@mimmozzo [email protected]

Page 2: Event driven architecture in practice

Who am I ?

Page 3: Event driven architecture in practice

What do I do ?

.NET

Web REST

AgileAutomation Testing

C#Team leading

Ruby

Page 4: Event driven architecture in practice

Agenda

• SOA

• EDA

• Communication patterns

• Advantages

• Disadvantages

• Q & A

Page 5: Event driven architecture in practice

Where is Agile going ?

Page 6: Event driven architecture in practice
Page 7: Event driven architecture in practice

PROCESS MATTERS

Page 8: Event driven architecture in practice

CODE MATTERS

Page 9: Event driven architecture in practice

Agile = no work upfront

Page 10: Event driven architecture in practice

Agile = no work upfront

No work upfront = no architecture planning

Page 11: Event driven architecture in practice

Architecture is not design

Page 12: Event driven architecture in practice

Agile = no work upfront

No work upfront = no architecture planning

Page 13: Event driven architecture in practice

Agile = no work upfront

No work upfront = no architecture planning

Agile = no design upfront

Page 14: Event driven architecture in practice

We can start now

Page 15: Event driven architecture in practice

A big code base…

Page 16: Event driven architecture in practice

• Build time

• Difficult to test

• No real boundaries

Page 17: Event driven architecture in practice

Does not scale

Page 18: Event driven architecture in practice

Event Driven Architecture

Page 19: Event driven architecture in practice

• Architecture is mainly business driven

• Business capabilities

Page 20: Event driven architecture in practice

Business capability

• Owns a part of the system

• Well defined responsibilities

• Owns a model (set of entities)

• Set of components (services, api)

• Isolated database

• Isolated deploy

Page 21: Event driven architecture in practice
Page 22: Event driven architecture in practice
Page 23: Event driven architecture in practice

SOA

Page 24: Event driven architecture in practice

FILES

DISCUSSIONS MEETINGS

TASKS

SOA FLOW

Page 25: Event driven architecture in practice

FILES

DISCUSSIONS MEETINGS

TASKS

SOA FLOW

Page 26: Event driven architecture in practice

FILES

DISCUSSIONS MEETINGS

TASKS

SOA FLOW

Page 27: Event driven architecture in practice

FILES

DISCUSSIONS MEETINGS

TASKS

SOA FLOW

Page 28: Event driven architecture in practice

EDA FLOW

FILES DISCUSSIONS MEETINGSTASKS

COMMUNICATION CHANNEL

Page 29: Event driven architecture in practice

Upload document with SOA

FILESCLIENTUpload document

TASKS NOTIFICATION PREVIEW

Page 30: Event driven architecture in practice

Upload document with EDA

FILESCLIENTUpload document

COMMUNICATION CHANNEL

TASKS NOTIFICATION PREVIEW

Page 31: Event driven architecture in practice

Communication patterns

• Database

• Files

• Messaging

Page 32: Event driven architecture in practice

Channels

• Logical address

• Datatype

Page 33: Event driven architecture in practice

• Events

• Commands

• Document Messages

Types of messages

Page 34: Event driven architecture in practice

A simple event

• ID

• Past sequence

• Informing the outside world that something happened

Page 35: Event driven architecture in practice

NewDocumentUploaded

{

Id:1,

DocumentId:100

}

Page 36: Event driven architecture in practice

Commands

SendEmail{

Id: 100,

To: ‘[email protected]’,

From: ‘[email protected]’,

Subject: ‘Welcome to huddle’,

Content: ‘Enjoy’

}

Page 37: Event driven architecture in practice

Document Message

UserRegistered{

Id: 100,

Name: ‘Domenico’,

LastName: ‘Musto’,

Email: ‘[email protected]’,

Twitter: ‘@mimmozzo’,

Avatar: ‘http://my.huddle.net/mimmozzo/avatar’

}

Page 38: Event driven architecture in practice

Reference Data

Page 39: Event driven architecture in practice

COMM. CHANNEL

NOTIFICATION

NewDocumentUploaded{

Id:1,DocumentId:100,WorkspaceId:200

}

FILES

Page 40: Event driven architecture in practice

PEOPLE

COMM.CHANNEL

UserRegistered{

Id: 100,Name: ‘Domenico’,LastName: ‘Musto’,Email: ‘[email protected]’,Address: ‘London’,Twitter: ‘@mimmozzo’,Avatar: ‘http://my.huddle.net/mimmozzo/avatar’

}

Page 41: Event driven architecture in practice

COMM. CHANNEL

NOTIFICATION

Recipient

Id : intEmail : string

Page 42: Event driven architecture in practice

Eventual consistency

Page 43: Event driven architecture in practice

PEOPLE

COMM.CHANNEL

UserUpdated{

Id: 100,Email: ‘[email protected]’SomeField: ‘some_value’

}

NOTIFICATION

Page 44: Event driven architecture in practice

COMM. CHANNEL

NOTIFICATION

RECIPIENTS

Page 45: Event driven architecture in practice

Messages order

Page 46: Event driven architecture in practice

Versioning

Page 47: Event driven architecture in practice

PEOPLE

COMM.CHANNEL

UserUpdated{

Id: 100,Email: ‘[email protected]’,SomeField: ‘some_value’,Version: 3

}

COMM. CHANNEL

NOTIFICATION

Recipient

Id : 100Email : ‘[email protected]’Version: 1

Page 48: Event driven architecture in practice

PEOPLE

COMM.CHANNEL

UserUpdated{

Id: 100,Email: ‘[email protected]’,SomeField: ‘some_value’,Version: 2

}

COMM. CHANNEL

NOTIFICATION

Recipient

Id : 100Email : ‘[email protected]’Version: 3

Page 49: Event driven architecture in practice

Idempotency

Page 50: Event driven architecture in practice

Ability to replay messages

Page 51: Event driven architecture in practice

Events publisher

Page 52: Event driven architecture in practice

PEOPLE PEOPLEEVENTS

PEOPLE EVENT PUBLISHER

COMMUNICATION CHANNEL

Page 53: Event driven architecture in practice

Testing

Page 54: Event driven architecture in practice

Our infrastructure

• RabbitMQ

• Reactive Extensions

• JSON as message format

Page 55: Event driven architecture in practice

Business monitoring

Page 56: Event driven architecture in practice

Big picture

Page 57: Event driven architecture in practice

Thanks.

@mimmozzo [email protected]