Building Event Driven Systems

41
Building Event Driven Systems Shiroshica Kulatilake Solutions Architect

Transcript of Building Event Driven Systems

Page 1: Building Event Driven Systems

Building Event Driven Systems

Shiroshica KulatilakeSolutions Architect

Page 2: Building Event Driven Systems

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

Page 3: Building Event Driven Systems

Enterprise Systems & Events

Page 4: Building Event Driven Systems

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

Page 5: Building Event Driven Systems

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

Page 6: Building Event Driven Systems

Event Driven Architecture

Page 7: Building Event Driven Systems

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

Page 8: Building Event Driven Systems

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

Page 9: Building Event Driven Systems

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

Page 10: Building Event Driven Systems

Advantages

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

Page 11: Building Event Driven Systems

Generic EDA Pattern

Page 12: Building Event Driven Systems

Event Mediator Pattern

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

Page 13: Building Event Driven Systems

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

Page 15: Building Event Driven Systems

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

Page 16: Building Event Driven Systems

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

Page 17: Building Event Driven Systems

Patterns in building Event Driven Systems

Page 18: Building Event Driven Systems

Centralized Message Driven System

Page 19: Building Event Driven Systems

Sample Solution

Page 20: Building Event Driven Systems

Sample Extended Solution

Page 21: Building Event Driven Systems

Autonomous Message Driven System

Page 22: Building Event Driven Systems

Sample Solution

Page 23: Building Event Driven Systems

Sample Extended Solution

Page 24: Building Event Driven Systems

Request Rate Controlling

Page 25: Building Event Driven Systems

Guaranteed Delivery - Directly via Broker

Page 26: Building Event Driven Systems

Guaranteed Delivery - via Mediation Engine

Page 27: Building Event Driven Systems

Guaranteed Delivery - Fault Handling

Page 28: Building Event Driven Systems

Monitoring and Alerting

Page 29: Building Event Driven Systems

Keeping up with the trends

Page 30: Building Event Driven Systems

Internet of Things (IoT)

Image: thinkpublic/photopin cc

Page 31: Building Event Driven Systems

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

Page 32: Building Event Driven Systems

Internet of Things (IoT)

Image: thinkpublic/photopin cc

Page 33: Building Event Driven Systems

Microservices Architecture

Image: thinkpublic/photopin cc

Page 34: Building Event Driven Systems

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

Page 35: Building Event Driven Systems

Microservices Architecture

Image: thinkpublic/photopin cc

Page 36: Building Event Driven Systems

Reactive Architecture

Image: thinkpublic/photopin cc

Page 37: Building Event Driven Systems

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

Page 38: Building Event Driven Systems

Key take aways ...

Page 39: Building Event Driven Systems

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