TechDays 2010 Portugal - Event Driven Architectures - 16x9

51
Event-Driven Architecture Como, Quando e Porquê? ARC316 N uno Godinho Partner & CTO @ ITech4All [email protected] @NunoGodinho

description

Microsoft TechDays 2010 Portugal Session

Transcript of TechDays 2010 Portugal - Event Driven Architectures - 16x9

Page 1: TechDays 2010 Portugal - Event Driven Architectures - 16x9

Event-Driven Architecture Como, Quando e Porquê?

ARC316

Nuno GodinhoPartner & CTO @ [email protected]

@NunoGodinho

Page 2: TechDays 2010 Portugal - Event Driven Architectures - 16x9

Nuno Filipe GodinhoPartner & CTO @ ITech4all

Mail: [email protected]@sapo.pt

Blogs: http://pontonetpt.com/blogs/nunogodinhohttp://xamlpt.com/blogs/nunogodinhohttp://weblogs.asp.net/nunogodinhohttp://msmvps.org/blogs/nunogodinho

Twitter: @NunoGodinho

About Me

Page 3: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Introduction• Event Driven Architecture• SOA vs EDA• How to Implement• Resources• Q&A

Agenda

Page 4: TechDays 2010 Portugal - Event Driven Architectures - 16x9

Introduction

Page 5: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• SOA is a synchronous RPC (mostly over Web services)

• EDA is SOA

• The best of EDA and SOA is combined in SOA 2.0

IntroductionCommon Thoughts about SOA and EDA

Page 6: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Moving towards on-Demand Business. Why?• Organizations tend to change their structure frequently

• Parts of the business process are outsourced to External Partners

• Departments and business units are seen now as service providers

• Focus not only internally on the organization, but they are seeking for external markets to offer their services

IntroductionTrend Change

Page 7: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Moving towards on-Demand Business. Why?• Everything is moving toward on-demand

business where service providers react to impulses from the environment.

• Loose coupling between application components

IntroductionTrend Change

Page 8: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Linking application to simplify and automate a process, while avoiding changes to existing applications

IntroductionSample Painpoint : EAI – Enterprise Application Integration

Page 9: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• File Tranfer• Import and Export Files

• Common Issues:• Various Formats • Needs Translation• Manually Loaded

IntroductionHow to Solve this painpoint?

Page 10: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Shared Databases• Making integration on the Database

Level• Several Applications share the same

Database

• Common Issues:• Data is tightly coupled to multiple

applications• Incremental or partial updates are

impossible

IntroductionHow to Solve this painpoint?

Page 11: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Web Services• Providing Services to

automate the integration

• Common Issues:• Requires services to be

available at invocation• Results in multiple call

stacks• Resource consuming

• Yet another Remote Procedure Call (RPC, COM, Corba, DCOM, ...)

IntroductionHow to Solve this painpoint?

Page 12: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Messaging• Using Messaging

mechanisms

• Basics:• Defined data format• Asynchronous

Operations• Minimized Coupling• Fault Tolerance• Data Freshness

IntroductionHow to Solve this painpoint?

Page 13: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Messaging• Defined data format

• Contract between Producer and Consumer• Internal formats remain private• Integration is maintained at the edge of the

application, to prevent internal changes to impact the interface

IntroductionHow to Solve this painpoint?

Page 14: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Messaging• Asynchronous Operations

• Processes run on their own context• Source process continues• No need for the service to be always

available

IntroductionHow to Solve this painpoint?

Page 15: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Messaging• Minimized Coupling

• Additive Model reducing the changes needed to existing systems

• Reduces dependencies• Increases service reuse• Enable Isolated Service Testing

IntroductionHow to Solve this painpoint?

Page 16: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Messaging• Fault Tolerance

• Durable Messaging

• Improved recoverability

• Compensating Actions to handle partial failures

IntroductionHow to Solve this painpoint?

Page 17: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Messaging• Data Freshness

• Favors small data transfer• Minimized data exchange latency

IntroductionHow to Solve this painpoint?

Page 18: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Events• Represent a change in state• Self-Contained

• Pure and complete representation of an Event

• No references to other data sources• Reduces dependencies, Loosens coupling

• Uniquely indentified• Enabled idempotent handling events• Improves tracebility of related processing• Allows correlation with related events

IntroductionHow to Solve this painpoint?

Page 19: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Events• Time relevant, not time sensitive• Sourced using messaging• Observable

• Published events can be observed by multiple subscribers

• Event stream Processing

IntroductionHow to Solve this painpoint?

Page 20: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Event Types• Execution• Lifecycle• Management• Business

IntroductionHow to Solve this painpoint?

Page 21: TechDays 2010 Portugal - Event Driven Architectures - 16x9

Event Driven Architecture

Page 22: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Architecture pattern that orchestrates behavior around:• Production• Detection • Consumption of events as well as the responses they

invoke.

• A method for building enterprise systems in which events flow between decoupled components and services

• A maintainable, sustainable and extensible model for building complex, distributed applications

Event Driven ArchitectureWhat is EDA?

Page 23: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Suited for Asynchronous, unpredictable environments

• Extremely Loosely Coupled

• Inversion of communication

Event Driven ArchitectureWhat is EDA?

Page 24: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Companies must manage and react to a large number events every day in real time• Real time trade settlement systems• Flight reservation system• Streaming stock data• Real time vehicle location for transportation companies• Stock Exchange Market systems

• System designers normally must support both events and Services

• Systems must be “Business Oriented”

Event Driven ArchitectureWhy do we need EDA?

Page 25: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Concerns events that are directly related to specific, measurable changes of condition

Event Driven ArchitectureSimple Event Processing

Page 26: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Both ordinary and notable events happen

Event Driven ArchitectureStream Event Processing

Page 27: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Allows patterns of simple and ordinary events to be considered to infer that a complex event has occurred

Event Driven ArchitectureComplex Event Processing

Page 28: TechDays 2010 Portugal - Event Driven Architectures - 16x9

SOA-2: Event-Driven Service Oriented Architecture

Event Driven ArchitectureWhat is Complex Event Processing?

time1 2 3 4 5 6 7 8 9

Event Stream Processing Complex Event Processing

Event pattern of significance where prompt detection and action can have materially impact

Page 29: TechDays 2010 Portugal - Event Driven Architectures - 16x9

SOA-2: Event-Driven Service Oriented Architecture

Event Driven ArchitectureWhat is Complex Event Processing?

ALL WITHIN any 2 minute time period

time

Real-

time D

ata St

reams

!

AND ( HPQ’s price moves up by 5%

!

WHEN MSFT price moves outside 2% of MSFT-15-minute-VWAP

!

OR MSFT’s price moves down by 2% )) !

FOLLOWED-BY ( S&P moving by 0.5%

THEN BUY MSFT SELL HPQ

NASDAQ

NYSE

MSFT 15-MIN-VWAP

S&P500

Complex event sequences

Multiple data streams

Real-time constraints Automated actions

Temporal sequencing

Page 30: TechDays 2010 Portugal - Event Driven Architectures - 16x9

Event Driven ArchitectureImplementation Components

Page 31: TechDays 2010 Portugal - Event Driven Architectures - 16x9

Event Driven ArchitectureEvent Processing Engine

Page 32: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Event Generator• Event Channel• Event Processing Engine• Downstream Activity

Event Driven ArchitectureEvent Flow Layers

Page 33: TechDays 2010 Portugal - Event Driven Architectures - 16x9

SOA-2: Event-Driven Service Oriented Architecture

Event-driven ProcessAutomating the basic process

OTHER SERVICES

OTHER SERVICES

OTHER SERVICES

TRADINGDESK

ORDER MANAGEMENT

SYSTEM

ECN

TRADER

BROKER

EXCHANGE

Investment manager wants order management system integrated with trading desk

Page 34: TechDays 2010 Portugal - Event Driven Architectures - 16x9

SOA-2: Event-Driven Service Oriented Architecture

Event-driven ProcessesOperational improvement

OTHER SERVICES

OTHER SERVICES

ORDER MANAGEMENT

SYSTEM

ECN

COMPLIANCEENGINE

OTHER SERVICES

TRADINGDESK

TRADERFUND MANAGER

INBOUNDTRANSFORMATIONOUTBOUNDTRANSFORMATION

BROKER

EXCHANGE

?

President wants compliance engine to monitor trading activities to eliminate cash liability during market swings

Page 35: TechDays 2010 Portugal - Event Driven Architectures - 16x9

SOA-2: Event-Driven Service Oriented Architecture

Event-driven ProcessesKeeping up with regulations

ORDER MANAGEMENT

SYSTEM

ECN

COMPLIANCE ENGINE

OTHER SERVICES

TRADINGDESK

TRADERFUND MANAGER

BROKER

EXCHANGE

LOGGING SERVICE

OTHER SERVICES

OTHER SERVICES

DB

INBOUNDTRANSFORMATIONOUTBOUNDTRANSFORMATION

?

Board wants trades logged for Sarbanes-Oxley and integrated with company-wide risk management

TOCORPORATERISK MGT

Page 36: TechDays 2010 Portugal - Event Driven Architectures - 16x9

SOA vs EDA

Page 37: TechDays 2010 Portugal - Event Driven Architectures - 16x9

SOA vs EDA

Service Oriented Architecture• Applications are

composed in design-time

• Linear flow between services

• Predictable behavior

• Request/Response is common, and often overused

Event Driven Architecture• Applications are

composed at run-time

• Asynchronous components

• Reactive behavior

Page 38: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Support strong cohesion in the business processes, situations where all process steps are under one control

• Commonly applied to:• Vertical interaction between the hierarchical layers of

functional decomposition• Functional request-and-reply processes such as man-

machine dialogues; the user waits for an answer• Processes with a transactional nature which require

commit and rollback facilities• Data enrichment in a message to be published to bring

the message to its full content in a formal format

SOA vs EDAWhen to use SOA?

Page 39: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Support independency between business process steps

• Commonly applied to:• Horizontal communication between

tiers in a process chain• Workflow type of processes• Processes that cross recognizable

functional organization borders, external (B2B) as well as internal

SOA vs EDAWhen to use EDA?

Page 40: TechDays 2010 Portugal - Event Driven Architectures - 16x9

SOA vs EDAVisualization

Page 41: TechDays 2010 Portugal - Event Driven Architectures - 16x9

How to Implement

Page 42: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Using Web service technologies today, and additional SOAP-aware message queuing infrastructure.

• Current ESB infrastructures provide a way of message queuing combined with Web service technologies.

• SOA and EDA implementations must be regarded in the context of Business Process Management (BPM)

How to Implement

Page 43: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Modern BPM-tools are based on BPEL (Business Process Execution Language)• Current BPEL implementation focuses strongly on the

command-and-control model, the orchestration of services, and so on SOA

• Beside orchestration BPEL - to a certain extend - also supports workflow, a kind of choreography, which goes in the direction of EDA

• BPEL has a procedural nature

• EDA would rather be a declarative model.

How to Implement

Page 44: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Preparatory steps:1. Model business requirements into functions at the

granularity level of the desired autonomy.

2. Outline the application landscape to identify all affected systems.

3. Map the application landscape to the business function model.

4. Identify applications that cross functional borders as potential "agility bottlenecks" (assign a special high priority to those applications that are required to cross external organization borders).

• Basis for the decoupled service boundaries

How to ImplementScenarios where SOA and EDA can easily co-exist

Page 45: TechDays 2010 Portugal - Event Driven Architectures - 16x9

Resources

Page 46: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Enterprise Integration Patterns (Gregor Hohpe and Bobby Woolf )

• Patterns for Enterprise Architecture (Martin Fowler)• SOA Patterns (Arnon Rotem-Gal-Oz, Eric Bruno, Udi

Dahan)

ResourcesBooks

Page 47: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• Event Processing: Designing IT Systems for Agile Companies (K. Chandy , W. Schulte)

• Event-Driven Architecture: How SOA Enables the Real-Time Enterprise (Hugh Taylor, Angela Yochem, Les Phillips, Frank Martinez)

• SOA Design Patterns (The Prentice Hall Service-Oriented Computing Series from Thomas Erl)

ResourcesBooks

Page 48: TechDays 2010 Portugal - Event Driven Architectures - 16x9

• http://soapatterns.net/

• http://www.enterpriseintegrationpatterns.com/

ResourcesSites

Page 49: TechDays 2010 Portugal - Event Driven Architectures - 16x9

Q & A

Page 51: TechDays 2010 Portugal - Event Driven Architectures - 16x9