apidays LIVE London 2021 - Reaching Maximum Potential in Banking & Insurance with API Mindset
October 27 & 28, 2021
The future API stack : GraphQL, gRPC and API specifications
Getting started with Event-Driven APIs
Hugo Guerrero, APIs & Messaging Developer Advocate at Red Hat
Take control of your SAP testing with UiPath Test Suite
apidays LIVE London 2021 - Getting started with Event-Driven APIs by Hugo Guerrero, Red Hat
1. 1
Getting started with event-driven
architecture based APIs
Event-Driven
APIs
EVENT-DRIVEN
APIs
Hugo Guerrero (@hguerreroo)
APIs & Messaging Developer Advocate
Red Hat
4. New York
JULY
Australia
SEPTEMBER
Singapore
APRIL
Helsinki & North
MARCH
Paris
DECEMBER
London
OCTOBER
Jakarta
FEBRUARY
Hong Kong
AUGUST
JUNE
India
MAY
Check out our API Conferences here
50+ events since 2012, 14 countries, 2,000+ speakers, 50,000+ attendees,
300k+ online community
Want to talk at one of our conferences?
Apply to speak here
12. EVENT-DRIVEN ARCHITECTURE
Microservices are Hard
11
Because applications must deal with
● Unpredictable failures
● End-to-end application correctness
● System degradation
● Topology changes
● Elastic/ephemeral/transient resources
● Distributed logs
● The fallacies of distributed computing
16. ● Limited fault tolerance
● No support for server initiated / peer-to-peer comms
● No help to manage transactions / long running
processes
● No buffering
● No delivery guarantees
Sometimes we really need “not-so-dumb” pipes
HTTP is easy but limited
EVENT-DRIVEN ARCHITECTURE
15
19. Why Event-Driven Architecture?
EVENT-DRIVEN ARCHITECTURE
18
Mirrors the real world
The real world is event-driven. Systems generate and
respond to events in everyday life, e.g., the human
central nervous system.
Reduced coupling
Traditional RPC-style service architecture results in
tightly-bound services. Changes to the application flow
typically require service code changes. EDA allows new
functionality to be added by adding services that
consume existing event streams.
Encapsulation
Microservices concepts have grown in popularity due to
the ability for service teams to develop services in
isolation. EDA means that service designers need not be
aware of how events are consumed.
Fine-grained scaling
Services can be independently scaled up and down to
meet the event volume.
Near real-time latency
Customers increasing expect a near real-time
experience. Polling on APIs is a delicate trade-off
between responsiveness and load. EDA allow apps to
react in near real-time without compromise.
20. Event-driven architecture use cases
19
Streaming between data centers
Reactive notification
Command query
responsibility segregation
(CQRS)
Auditing
Behavior capture
Cache store
Complex event
processing
Source:
EVENT-DRIVEN ARCHITECTURE
24. EVENT-DRIVEN ARCHITECTURE
Different protocols
23
Source:
● AMQP
○ Advanced Message Queuing Protocol
● STOMP
○ Simple (or Streaming) Text Orientated Messaging Protocol
● MQTT
○ Message Queuing Telemetry Transport
● KAFKA
○ Protocolo binario sobre TCP
● WEB
○ WebSockets
○ WebHooks
○ Server-Sent Events
25. Data Pipelines
24
EVENT-DRIVEN ARCHITECTURE
Source
Event Capture Apache
Kafka
Kafka Streams
API
Source
Systems
Kafka Connect +
Debezium Real Time
Decisioning (DM)
Event
Persistent
Storage
Target
Systems
Camel K
Storage /
Database
Events
Camel K
Producer API
Kafka Connect
Consumer API
Reactive
Application
s
(Quarkus)
Reactive
Application
s (Quarkus)
Event-driven
APIs
SaaS
28. How does it work on REST APIs?
EVENT-DRIVEN APIS
27
Source:
https://swagger.io/docs/specification/about/
https://www.apicur.io/
https://openapi-generator.tech/
https://microcks.io/
Build an API Specification
Using a tool like OpenAPI,
write an API specification FIRST
Publish the API Specification
Using a tool like Swagger or Apicur.io,
publish the API specification where others
have access and can collaborate
Generate Code, Mocks and Testing
Using a tool like OpenAPI Generator to create
the API stubs for both client and server
applications. You can also generate “mock”
services with Microcks.
29. Event-driven Contracts
EVENT-DRIVEN APIS
An open source initiative that seeks to improve the
current state of Event-Driven Architectures.
Created to describe Event-driven APIs using MQTT,
AMQP, Apache Kafka, ...
“Sister” specification to OpenAPI: same base syntax,
use JSON Schema underhood.
Allows definition of examples
33. AsyncAPI Anatomy
EVENT-DRIVEN APIS
32
https://www.asyncapi.com/docs/getting-started/coming-from-openapi
Info: metadata and documentation for this asynchronous API: version,
title, description, contact and licensing terms
Servers: list of brokers with binding details (URLs and security protocols)
Channel Item: destination that will be used by the API to publish or
consume events. Destination may be mapped to a topic, queue, address
name depending on the protocol binding.
Operation: whether the application using the AsyncAPI should subscribe
or produce messages. Holds its own descriptive metadata
Message: the content-type and structure of message headers and
payload. May reference schemas of different types (AsyncAPI, JSON,
Avro). May contain examples!
Components: Common definitions (schemas, traits, messages) like in
OpenAPI v3
37. EVENT-DRIVEN ARCHITECTURE
Red Hat Integration
36
Implementation Patterns with Event-Driven APIs
Source:
Event Sourcing
Event sourcing is a pattern that allows a
system to log data changes in timed-order.
Any service can then replay the log to
determine the current data state .
The ability to capture events when data
changes in the store, and auto populate
these events for other services that need
the latest state of the data is crucial to keep
data consistent.
Change Data Capture
These are systems that detect and react to
critical conditions by querying a continuous
data stream within a small time window.
Event Stream Processing
The flow of data has multiple stages and
consumers, forming a pipeline, or broadcast,
of information.
Broadcast and Pipelines
38. 37
EVENT-DRIVEN ARCHITECTURE
Some stories to Share
Employs AMQ Streams to feed
all data from legacy
applications (mainframe and
other) to new digital initiatives
built on OpenShift, and uses
AMQ Streams as asynchronous
delivery of data between
microservices.
Built comprehensive payments
network on AMQ Streams,
handling traffic of 2,000
messages per second for 200
million customers. This
payments network is not
dependent on card issuers and
is free of charge for users.
Italy’s financial and
communications powerhouse
built microservices platform on
AMQ Streams, OpenShift, and
other Red Hat products.
Speed of new development
has enabled PosteItaliane to
handle the 64% increase in
digital traffic due to COVID.
41. New York
JULY
Australia
SEPTEMBER
Singapore
APRIL
Helsinki & North
MARCH
Paris
DECEMBER
London
OCTOBER
Jakarta
FEBRUARY
Hong Kong
AUGUST
JUNE
India
MAY
Check out our API Conferences here
50+ events since 2012, 14 countries, 2,000+ speakers, 50,000+ attendees,
300k+ online community
Want to talk at one of our conferences?
Apply to speak here