This an era where Consumer Experience (CX) is king. Because of this, application users naturally expect to be notified of events and outcomes in real-time as they happen. Asynchronous and parallel execution of processes has become a necessity which has more to do with data and events streams rather than resting data. Reactive application development is all about programming for such event streams.
Modern day business applications are primarily based on events. Therefore, reactive application development has become a way to build applications that are more agile and highly extensible. Also, with the emergence of microservices-based applications, we see an increase in adaptation of event-driven architecture.
This presentation looks at the core concepts of event-driven architecture and how you can use it to design reactive applications.
[WSO2Con EU 2018] Building Reactive Applications Using Event Driven Architecture
1. Associate Lead Solutions Engineer, WSO2
Building Reactive Applications Using
Event-driven Architecture
Chathura Kulasinghe
2. Reactiveness is a design of the Nature
- Event & the change of State
- triggers the Reaction
- based on the State (data)
- different parties
- execute different activities
- in different flows
- Event-source doesn’t care
3. View-model »
{ code }
{ trim }
{ engine }
{ transmission }
{ suspension }
{ exterior_color }
{ auction_price }
Used commonly in UI/UX designing
4. View-model »
{ code }
{ trim }
{ engine }
{ transmission }
{ suspension }
{ exterior_color }
{ auction_price }
Events streams » State change » Reactions
events change of
State
Reactions
Reactions
5. Qualities of
Reactive Systems
1. Responsive (The Objective)
○ what clients experience
2. Scalable (The Design)
○ manageable in larger capacities
3. Resilient (The Design)
○ designed for failure
○ self-healing/recovery
4. Message-driven (The foundation)
○ asynchronous processing
○ parallel execution
7. Reactive applications
● Message-driven —react to change of State.
● Enterprise solutions can benefit by adopting this concept.
● Especially,
○ in a distributed deployment
○ of hundreds of Smart Network Endpoints.
● Because,
○ a single change of state (in reaction) can Trigger
○ many independent sequences of following actions.
8. Applications as Smart Network Endpoints
● Communication
○ between/among independent systems
○ which see each other as Black Boxes through the network
● Require
○ a universal communication mechanism
○ i.e. HTTP API invocation, messaging, streaming
● Treating
○ each other as Smart (network) Endpoints
○ within the programme code
9. Event Driven
Architecture
- Event Notification
- Event-carried State Transfer
- Event-Sourcing
- CQRS
Command Query Responsibility
Segregation
Sources (by Martin Fowler):
https://martinfowler.com/articles/201701-event-driven.html
https://www.youtube.com/watch?v=STKCRSUsyP0
https://bit.ly/2kF9hgZ
https://bit.ly/2fluUVm
10. Command-driven — Imperative
Online
Banking App
Applying for
an Overdraught
Credit
Profiling
System
Re-evaluate
Credit-profile
Core
Banking
System
Create an
Overdraught
Online Banking App
is aware of the
existence of all other
related systems.
controls what needs
to happen in all other
related systems.
Has knowledge of
the overall behaviour
Tenant of
22B Wales Street
11. Event Notification
Online
Banking App
Applying for
an Overdraught
Tenant of
22B Wales Street
Credit
Profiling
System
Core
Banking
System
Online Banking App
Doesn’t need to be
aware of the existence
of any other related
systems.
Doesn’t need to
control what should
happen in any other
related systems.
Has no knowledge of
the overall behaviour
Event-notification »
Overdraught Requested
12. Event Notification — retrieving data
Online
Banking App
Applying for
A Car Loan
Tenant of
22B Wales Street
Credit
Profiling
System
Core
Banking
System
Other Systems
Listen the events
channel.
Trigger actions or
activity flows upon the
appearance of an
event.
Make secondary calls
to the Query/Fetch
details from Online
Banking App - Data
sources.Core Banking System »
Request/Fetch details of the
requested Car-Loan
Event-notification »
Overdraught Requested
13. Event-carried State Transfer
Online
Banking App
Applying for
an Overdraught
Tenant of
22B Wales Street
Credit
Profiling
System
Core
Banking
System
Other Systems
Listen the events
channel.
Trigger actions or
activity flows upon the
appearance of an
event
Locally Persist State
carried by the Event.
Event + State Object »
Overdraught Requested + Details
Other Systems »
Persist the valuable details of
the requested Overdraught
for later usage
14. Event-Sourcing
Online
Banking App
Applying for
a Overdraught
Tenant of
22B Wales Street
events log »
- get credit-profile
- create overdraught
- post for approval
- get approval decision
- email decision
- update credit-profile
15. Event-Sourcing
Online
Banking App
Applying for
a Overdraught
Tenant of
22B Wales Street
events log »
- get credit-profile
- create overdraught
- post for approval
- get approval decision
- email decision
- update credit-profile
application state »
- credit-profile information
- overdraught details
- approval decision ⥳
- email template
- updated credit-profile data
- updated accounts information ⥳
16. n
Reference
Application 𝝰
Application 𝝱
Application 𝝲
Application 𝝳
event producer
event consumer
event producer
event producer
event consumer
event consumer
event stream producer
event streams consumer
APIGateway
n
n
n
n
n
n
Function as a
Service
17. n
Technologies
Application 𝝰
Application 𝝱
Application 𝝲
Application 𝝳
event producer
event consumer
event producer
event producer
event consumer
event consumer
event stream producer
event streams consumer
APIGateway
n
n
n
n
n
n
18. Reactive
Applications
Reference
● The applications 𝝳, 𝝲 and 𝝱 are
○ Subscribers
○ function-as-a-service modules
○ triggered by events consumption
● Event with State is a Message
○ message-driven nature is the
foundation of Reactive applications
● Serverless architecture makes it
○ Highly-scalable
○ Resilient
● Overall experience is Responsive
○ Responds to change-of-state
○ Responds to load
○ Responds to error
19. is a language built to compliment
- cloud-native
- serverless
- integration-focussed
application designs, which provides
native support for
- common messaging-data-formats
- stream-processing and
- pub-sub implementation
A choice
which you can live
with...