Programming Without a Call Stack: Event-driven Architectures



Similar documents
Enterprise Integration Patterns

The Cloud as the New Middleware Platform

Home - Enterprise Integration Patterns

Service Mediation. The Role of an Enterprise Service Bus in an SOA

Mashing Up with Google Mashup Editor and Yahoo! Pipes

Part 2: The Neuron ESB

Building a Reliable Messaging Infrastructure with Apache ActiveMQ

ATHABASCA UNIVERSITY. Enterprise Integration with Messaging

Business Process Execution Language for Web Services

A standards-based approach to application integration

Datatype Channel p. 111 Invalid Message Channel p. 115 Dead Letter Channel p. 119 Guaranteed Delivery p. 122 Channel Adapter p. 127 Messaging Bridge

Event-based middleware services

SCA-based Enterprise Service Bus WebSphere ESB

WHITE PAPER. Enabling predictive analysis in service oriented BPM solutions.

WSO2 Message Broker. Scalable persistent Messaging System

Combining Service-Oriented Architecture and Event-Driven Architecture using an Enterprise Service Bus

The Synergy of SOA, Event-Driven Architecture (EDA), and Complex Event Processing (CEP)

Software Service Engineering Architect s Dream or Developer s Nightmare?

Who are We Specialized. Recognized. Preferred. The right partner makes all the difference.

Applying SOA to OSS. for Telecommunications. IBM Software Group

A Unified Messaging-Based Architectural Pattern for Building Scalable Enterprise Service Bus

Service Oriented Architecture Based Integration. Mike Rosen CTO, AZORA Technologies, Inc.

WebSphere ESB Best Practices

Introduction to WebSphere Process Server and WebSphere Enterprise Service Bus

Listeners. Formats. Free Form. Formatted

Motivation Definitions EAI Architectures Elements Integration Technologies. Part I. EAI: Foundations, Concepts, and Architectures

AquaLogic ESB Design and Integration (3 Days)

Objectif. Participant. Prérequis. Pédagogie. Oracle SOA Suite 11g - Build Composite Applications. 5 Jours [35 Heures]

Getting Real Real Time Data Integration Patterns and Architectures

Building Scalable Applications Using Microsoft Technologies

What I Advise Every Customer To Do On Their Oracle SOA Projects

Enterprise Data Integration for Microsoft Dynamics CRM

SOA REFERENCE ARCHITECTURE: WEB TIER

Definition of SOA. Capgemini University Technology Services School Capgemini - All rights reserved November 2006 SOA for Software Architects/ 2

OsEra Enterprise Service Bus

Service-Oriented Architecture and its Implications for Software Life Cycle Activities

IBM WebSphere ESB V6.0.1 Technical Product Overview

DeBruin Consulting. Key Concepts of IBM Integration Broker and Microsoft BizTalk

Persistent, Reliable JMS Messaging Integrated Into Voyager s Distributed Application Platform

Enterprise Integration Patterns

WELCOME. Where and When should I use the Oracle Service Bus (OSB) Guido Schmutz. UKOUG Conference

EXAM PRO:Design & Develop Windows Apps Using MS.NET Frmwk 4. Buy Full Product.

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur

Ce document a été téléchargé depuis le site de Precilog. - Services de test SOA, - Intégration de solutions de test.

Event-Driven Architecture Overview

Enterprise Application Integration

Siebel Business Process Framework: Workflow Guide. Siebel Innovation Pack 2013 Version 8.1/8.2 September 2013

Di 6.1a. Warum naive SOA scheitert Ein Erfahrungsbericht. Adam Bien. January 26-30, 2009, Munich, Germany ICM - International Congress Centre Munich

Sentinet for BizTalk Server SENTINET

Collaborative Open Market to Place Objects at your Service

The Service Revolution software engineering without programming languages

Service-Oriented Architectures

Enterprise Application Integration (EAI) Architectures, Technologies, and Best Practices

The Enterprise Service Bus: Making Service-Oriented Architecture Real

FioranoMQ 9. High Availability Guide

Oracle Service Bus Examples and Tutorials

Introduction to Enterprise Service Bus

How To Create A C++ Web Service

Architectural Patterns (3)

SOA Blueprints Concepts

Questions? Assignment. Techniques for Gathering Requirements. Gathering and Analysing Requirements

Deploying to WebSphere Process Server and WebSphere Enterprise Service Bus

Service Oriented Architecture 1 COMPILED BY BJ

ESB solutions Title. BWUG & GSE Subtitle guy.crets@i8c.be. xx.yy@i8c.be

Creating new university management software by methodologies of Service Oriented Architecture (SOA)

<Insert Picture Here> Getting Coherence: Introduction to Data Grids South Florida User Group

Message Oriented Middlewares

EVALUATION. WA1844 WebSphere Process Server 7.0 Programming Using WebSphere Integration COPY. Developer

10 Years of Hype Cycles - Do We Forget Knowledge?

CLOUD BASED SEMANTIC EVENT PROCESSING FOR

Enterprise Integration Patterns

Developing SOA solutions using IBM SOA Foundation

Enhanced Connector Applications SupportPac VP01 for IBM WebSphere Business Events 3.0.0

Service Virtualization: Managing Change in a Service-Oriented Architecture

Environment Modeling for Automated Testing of Cloud Applications

Designing an Enterprise Application Framework for Service-Oriented Architecture 1

WHITE PAPER. Talend Enterprise ESB Technical Overview

CHAPTER 10: WEB SERVICES

Guiding Principles for Modeling and Designing Reusable Services

Agenda. Some Examples from Yahoo! Hadoop. Some Examples from Yahoo! Crawling. Cloud (data) management Ahmed Ali-Eldin. First part: Second part:

ENZO UNIFIED SOLVES THE CHALLENGES OF OUT-OF-BAND SQL SERVER PROCESSING

Oracle Mobile Suite and Oracle Adaptive Case Management

SOA Patterns and Best Practices

Service Oriented Architecture (SOA) An Introduction

PERFORMANCE COMPARISON OF COMMON OBJECT REQUEST BROKER ARCHITECTURE(CORBA) VS JAVA MESSAGING SERVICE(JMS) BY TEAM SCALABLE

A Modeling Language for Activity-Oriented Composition of Service-Oriented Software Systems

Contents 1 Overview 2 Introduction to WLS Management Services iii

Transcription:

Gregor Hohpe Google Programming Without a Call Stack: -driven Architectures www.eaipatterns.com Who's Gregor? Distributed systems, enterprise integration, service-oriented architectures MQ, MSMQ, JMS, TIBCO, BizTalk, Web Services Write code every day. Share knowledge through patterns. eaipatterns.com Patterns Articles Blog Enterprise Integration Patterns Addison-Wesley Integration Patterns Microsoft Press Enterprise Solution Patterns Microsoft Press Best Software Writing I APress SOA Expertenwissen dpunkt Verlag 1 1

Agenda It's All About Coupling s Everywhere -driven Architectures Developing in an EDA Case Study: Building an EDA in Java TM 2 In A Connected World It's All About Coupling "Measure of dependency between components" 3 2

Dynamic Composability "The ability to build new things from existing pieces." 4 Interaction Takes Center Stage 5 "The lines are becoming boxes now." -- Ralf Westphal 3

The World is Full of s Inventory Low Ware house Shipping Partner Truck Delayed Entry New Cloud E-mail Bounced Mail Gateway Address Changed Web Site Payment Declined Credit Card Expired Financial System 6 -Driven Architecture (EDA) Channel Node Distributed processing, no central control. Nodes respond to incoming events and publish events in response. channels transport events from one node to the next, usually asynchronously (sender does not wait). Composition through channels. 7 4

EDA Defining Qualities Timeliness. Publish events as they occur instead of waiting for the next batch cycle. A Asynchrony. The publishing system does not wait for the receiving system(s) to process the event. A Queue B Fine Grained. Publish single events as opposed to large aggregated event. A Ontology. A nomenclature to classify and express interest in certain groups of events. Complex Processing. Understanding the relationships between events, for example aggregation and causality. Updated s On-Line New 8 Composition via Channels System A publish Channel X subscribe System B Nodes communicate via Channels Sender and receiver need to agree to a common channel. This is a form of coupling. Sender and receiver have to decide which channel is right. The burden can be shifted between sender and receiver. Channel namespace provides some structure. 9 5

Channel Naming and Semantics Target component Entry CreditService Credit Service Action / Operation Entry VerifyCreditCard Credit Service Document Entry PaymentInfo Credit Service Entry Received Credit Service 10 How Do A and B Connect? Structured Channel Name / Instance Common in message queue systems. Limited expressiveness. MessageQueue q = new MessageQueue( foo"); q.send( Msg ); Topic Hierarchy Allows wildcard subscription Requires mapping of topic space onto a tree. Forces prioritization. Updated s On-Line New Content-based Flexible, but difficult to implement efficiently in widely distributed systems. Channel.Subscribe( /element/foo= bar ); Unstructured 11 6

Composition Strategies Implicit Composition Explicit Composition channel = Channel.byName( orders ); channel.publish(message); A(Channel ch) { this.channel = ch; channel.publish(message); A A Channel orders <<create>> Composer B B Channel channel = Channel.byName( orders ); channel.subscribe(eventhandler); B(Channel ch) { this.channel = ch; channel.subscribe(eventhandler); 12 Collaboration Multiple Components work together by communicating with each other by sending events when their internal state changes. (Fowler) Request Collaboration Management RequestFor Address Address Customer Management Shipping SendShipment Collaboration Management Customer Shipping Management Address Changed 13 7

Collaboration Adding Consumers is Side-Effect Free Debugging / logging / sniffing Parallel implementations Simple components, more complex interactions Robust against unstable connections Can be difficult to manage and /or debug Need to understand relationship between events Shift burden from design-time to run-time Components may operate on stale data 14 -sourced Systems Capture all changes to an application state as a sequence of events. (Fowler) Persisted State (Snapshot) Local State Domain Objects State Changes Bus Log 15 8

-sourced Systems More than an event log or "temporal database" Rebuild state based on events by re-executing behavior Temporal Query Determine application state at specific point in time replay Run "what if" scenarios or corrections to past events Limitation: code changes 16 Composite s Processing Understand causality Some events are the result a of a sequence of events Causality CEP = Complex Processing Pattern matching languages can be challenging Aggregation 17 9

Case Study Existing System UI Client A B C On-line DB FrontEnd Copy Proc Report DB Compute Proc Compute statistics based on responses to on-line questionnaires Responses stored in database At the end, stored procedure computes scores based on user responses Load on RDBMS Single thread, monolithic, synchronous Poor response time at end of user session Goal: scalable, extensible architecture 18 Case Study New Architecture UI Client Log -driven Calculators A B C FrontEnd Persistence DB Decompose logic into individual calculators Calculators precompute results as response events arrive Channels connect calculators Calculators do not updates database Persist results into database once all scores computed Pure Java (1.4) implementation 19 10

Design Decisions Point-to-Point vs. Publish-Subscribe Channels Distributed vs. Distributable Asynchronous vs. One-Way Technology Specific vs. Technology Neutral Explicit vs. Implicit Composition Channel Naming ontology String match Hierarchy (Class Hierarchy) Content-based Automated Dispatch vs. Manual Dispatch 20 Implementation public interface Channel { public void send( event); Marker Interface public void subscribe(recipient recipient, Class eventclass); Multiple calculators subscribe to abstract Channel Channel stores subscribers by event type (hierarchy) For each incoming event, channel looks up all subscribers for the event type and its superclasses For each subscribing class, figure out the overriding on method with the most specific matching argument 21 11

Subscription / Dispatching Hierarchy Some Sub1 Sub2 Incoming No invocation Class Some extends { class Sub1 extends Some { class Sub2 extends Some { class SomeSubscriber { public SomeSubscriber { channel.subscribe(some.class); Sub2 Sub1 invoke invoke public void on ( e) { public void on (Sub1 se) { 22 Channel Implementation public void send( event) { Set<Recipient> subscribers = getsubscribersfortypeanditssupertypes(event.getclass()); for (Recipient recipient : subscribers) { ProcessorHelper.invokeHandler(event, recipient); Map<Class, Set<Recipient>> subs; Set<Recipient> getsubscribersfortypeanditssupertypes (Class eventclass) { Set<Recipient> allsubscribers = new HashSet<Recipient>(); for (Map.Entry<Class, Set<Recipient>> entry : subs.entryset()) { Class subscriberclass = entry.getkey(); if (subscriberclass.isassignablefrom(eventclass)) { allsubscribers.addall(entry.getvalue()); return allsubscribers; 23 12

Channel Implementation (Cont'd) boolean invokehandler( event, Recipient recip) { for (Class eventclass = event.getclass(); eventclass!= null; eventclass = eventclass.getsuperclass()) { Method eventhandler = recip.getclass().getmethod ("on", new Class[]{eventClass); try { eventhandler.invoke(recip, new Object[] {event); return true; catch ( ) { if (.class.equals(eventclass)) return false; return false; 24 Channel Behaviors public void testeachsubscriberreceivesmessage() { public void testsubscribetwicereceiveonce() { public void testbaseclasssubscriberreceivesderivedclasss() { public void testsubscribingfornontypethrows() { public void testinvokesexactlymatchingmethodforbasetype() { public void testinvokesexactlymatchingmethodforsubtype() { public void testdoesnothingforoverlyspecifichandler() { public void testinvokesmostspecificmethodifbothareavailable() { 25 13

Cool Things Testing components in isolation Publish-subscribe enables adding rather than replacing Replay of events to recover transient state Tracing / logging trivial, almost aspect-like public class DebugCalculator extends Calculator { public DebugCalculator(Channel channel) { super(channel); channel.subscribe(this,.class); Base class of all events public void on( event) { System.out.println("event = " + event); 26 (Tough) Lessons Learned Must keep architectural big picture in mind Integration testing more critical less compile time validation (the price of loose coupling) Tools essential logger Dependency visualization ( reverse MDA ) Shared state not always avoidable. Can lead to hidden dependencies Make minimum necessary assumptions about sequence of events Loosely coupled systems harder to diagnose 27 14

Call Stack Top-down Side-By-Side -Driven Bottom-up Design-time composition Sequential Synchronous Predictive Transactional (Pessimistic) Centralized state Error handling simple Run-time composition Parallel Asynchronous Reactive Compensation / Retry (Optimistic) Distributed state Error handling more complex Diagnostics more complex 28 29 15

For More Information Enterprise Integration Patterns Addison-Wesley, 0-321-20068-3 www.eaipatterns.com Article: Programming without a Call Stack Blog ("Ramblings") http://www.martinfowler.com/eaadev/collaboration.html http://www.martinfowler.com/eaadev/sourcing.html 30 16