Building Event Driven Systems

Post on 11-Apr-2017

437 views 0 download

Transcript of Building Event Driven Systems

Building Event Driven Systems

Shiroshica KulatilakeSolutions Architect

Setting Expectations

o Today’s Enterprise Systems and how events fit in

o What is Event Driven Architecture

o Patterns for building Event Driven Systems

o Summarize

Image: thinkpublic/photopin cc

Enterprise Systems & Events

Enterprises Today

o Distributed- Functionality is broken down into several sub systems - Located in multiple places

o Ubiquitous - Based on parties interacting through different means

o Connected- Built based on synergies- Own as well as partner systems need to interact with each

other efficiently

Image: thinkpublic/photopin cc

Events in Enterprise Systems

o Occurrence within the context of interest o A series of events depicting one event in the real world

- e.g. A customer placing an order in a retail systemo Not all events are of interest o Most everyday events can be dealt in an asynchronous manner o Occurrence of an situation (relevant event) requires something to

react to it - to move from one state to another o For this events should be detected, situations filtered and

processes notifiedo Leads to Event Driven Architecture

Event Driven Architecture

Evolutiono SOA

- Synchronous request response systems with asynchronous message delivery

- Technically loosely coupled - Functionally tightly coupled - Mostly centralized

o Evolving into EDA- Based on message driven model for information propagation- Spatial and temporal decoupling- Analogous to the operational model of an organisation where a

series of events take place

o Suited where- Distributed environments - Higher level of autonomy is needed at unit level

Image: thinkpublic/photopin cc

Main Components

o Event - significant happening which results in change of state from a business perspective

o Event generator- publishes eventso Event processor- consumes events and decide what to doo Event channel - medium where event lies before consumption

Principles

o Immediate information dissemination and reactive business process execution

o Fire and forget - push based mechanismo Single responsibility at practiceo Autonomous messages for the receiver to processo Higher decoupling - no need to bind to contractso Logical decoupling of functional units - not dependent and less

impact from change o Receiver driven flow control - more responsibility lies with receivers o Near real time information consistency

Advantages

o Effective data integrationo Low latency of information o High reactivenesso More accurate responseso High flexibility o Higher business agility

Generic EDA Pattern

Event Mediator Pattern

http://radar.oreilly.com/2015/02/variations-in-event-driven-architecture.html

Event Mediator Pattern

o Need to orchestrate multiple steps

o Orchestration happens through a central mediator

o Multiple steps need to happen in a certain order

o Processing will be done by separate entities which need to be invoked in many ways

o Fits scenarios which are complex, have some sort of orchestration logic and approval tasks etc as well

Image: thinkpublic/photopin cc

Broker Pattern

o Message flow is distributed across several processors with no orchestration

o Fits for use cases where the flow is entirely dependent on event receiving with no timing

o Once a processor is done with processing another event will be fired to the broker which will be consumed by another processor

Image: thinkpublic/photopin cc

Components in an Event Driven System

o Process Engine

o Mediation Engine

o Message Broker

o Business Activity Monitor

o Complex Event Processor

o Business Rules Manager

Image: thinkpublic/photopin cc

Patterns in building Event Driven Systems

Centralized Message Driven System

Sample Solution

Sample Extended Solution

Autonomous Message Driven System

Sample Solution

Sample Extended Solution

Request Rate Controlling

Guaranteed Delivery - Directly via Broker

Guaranteed Delivery - via Mediation Engine

Guaranteed Delivery - Fault Handling

Monitoring and Alerting

Keeping up with the trends

Internet of Things (IoT)

Image: thinkpublic/photopin cc

Internet of Things (IoT)

o There exists a plethora of devices which provide data in several contexts

o This data needs to be captured in order to analyze and derive intelligence and then take actions

o Point to point integration with each device is not a possibility

o Leads to the use of Event Driven Architecture through the use of protocols which work on publish-subscribe mechanisms - e.g. MQTT and also through handling large scale event analyzing

Image: thinkpublic/photopin cc

Internet of Things (IoT)

Image: thinkpublic/photopin cc

Microservices Architecture

Image: thinkpublic/photopin cc

Microservices Architecture

o Microservices promote distributed data management

o Data in microservices - Are private to a specific microservice - Use polygot persistence - Might not expose generic APIs for all possible modes of use

o However, business transactions span multiple microservices which would need accessing private data of other microservices

o Leads to the use of Event Driven Architecture where distributed data management is handled through the use of events

o Variants are event tables, transaction log mining and event sourcing which try to reduce errors relating to atomicity

Image: thinkpublic/photopin cc

Microservices Architecture

Image: thinkpublic/photopin cc

Reactive Architecture

Image: thinkpublic/photopin cc

Reactive Architecture

o To achieve being reactive, systems should be designed with containment of functionality in mind so that scaling, isolation of failures and adaptable fault tolerance happens

o Microservices Architecture can achieve this

o Also, for a system to be reactive it should be able to- React to Load through scalability- React to failure through recoverability- React to user experience effectively

o The ability to react to events and act accordingly becomes the main ingredient

o Leads to designing and building systems in an Event Driven manner

Image: thinkpublic/photopin cc

Key take aways ...

Building Event Driven Systems

o What does your enterprise system look like ?- Determine how complex or simple your system flows are- Determine how autonomous your processing units are- Determine how isolated your processing units should be

o What do you need to do with event processing ? - Identify both functional as well as operational needs

o Which pattern would suit you best ?- Select based on enterprise system characteristics and needs

o Which components do you need ?- Identity which middleware components you need to achieve the

above

Image: thinkpublic/photopin cc