SlideShare a Scribd company logo
August 26, 2021
Event-driven APIs &
Apache Kafka
Hugo Guerrero
APIs & Messaging Developer Advocate
Red Hat
Hugo Guerrero
Mexican @ MA, USA
APIs & Event-Driven
Specialist | Open Source
Advocate | History, Travel &
Food Enthusiast
@hguerreroo
apidays
Hong
Kong
Agenda
Event-driven APIs
Event-driven development
Kafkaesque Challenges
Contract-First
The REST of the World
AsyncAPI Spec
Event Schemas
Schemas as Contracts
Registry for Schemas
Event-driven APIs &
Modern Applications
apidays
Hong
Kong
What is the situation?
EVENT-DRIVEN APIS & APACHE KAFKA
4
@hguerreroo
Distributed Decoupled Highly Connected
apidays
Hong
Kong
What is the situation?
EVENT-DRIVEN APIS & APACHE KAFKA
5
@hguerreroo
Distributed Decoupled Highly Connected
Microservices
Request /
Response
Events
apidays
Hong
Kong
What is the situation?
EVENT-DRIVEN APIS & APACHE KAFKA
6
@hguerreroo
Distributed Decoupled Highly Connected
Microservices
Request /
Response
Events
apidays
Hong
Kong
Events
The Traditional Workflow
EVENT-DRIVEN APIS & APACHE KAFKA
7
Project Planning
The business experts spend time writing up a
project plan for a series of services and
potentially a user interface
Send to Developers
The various development teams attempt to
interpret the project plan and implement their
code so that they are compatible
Iterate and Integrate
The developer teams iteratively try to resolve
integration issues and spend loads of time
ensuring compatibility
apidays
Hong
Kong
Kafkaesque
EVENT-DRIVEN APIS & APACHE KAFKA
8
Photo credit: dbeck03 on VisualHunt
ENDPOINT DOCUMENTATION ?
DATA FORMAT AND
VALIDATION ?
MIS-UNDERSTANDING
Kafkaesque
EVENT-DRIVEN APIS & APACHE KAFKA
9
Photo credit: dbeck03 on VisualHunt
INFRASTRUCTURE ACCESS ?
PUBLISHERS & CONSUMERS
COMPLIANCE ?
EVENTS AVAILABILITY ?
SLOW TIME TO MARKET,
POOR QUALITY
Event-Driven APIs and
Contract-First Workflows
apidays
Hong
Kong
EVENT-DRIVEN APIS & APACHE KAFKA
11
Why Contract-First?
@hguerreroo
▸ Because you want to allow people to work independently
▸ Because you want to ensure consistency
▸ Because you need strong guarantees about service contracts
▸ Because you, your team, your customers, and your partners can collaborate
▸ Because you can save time by using code generators and testing tooling
apidays
Hong
Kong
How does it work on REST APIs?
EVENT-DRIVEN APIS & APACHE KAFKA
12
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.
apidays
Hong
Kong
Event-driven Secret Weapon
EVENT-DRIVEN APIS & APACHE KAFKA
13
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
AsyncAPI
https://www.asyncapi.com/
apidays
Hong
Kong
AsyncAPI
EVENT-DRIVEN APIS & APACHE KAFKA
14
asyncapi.org
apidays
Hong
Kong
Protocol agnostic:
▸ AMQP
▸ MQTT
▸ NATS
▸ HTTP
▸ WebSockets
▸ Kafka
▸ STOMP
▸ JMS
Open Source Tooling:
▸ Online playground
(playground.asyncapi.org)
▸ Code generators
▸ Documentation generators
▸ Editors
▸ Mocking
▸ Testing
Unified API contracts
EVENT-DRIVEN APIS & APACHE KAFKA
15
@hguerreroo
POST /register
{
"fullName":"John Doe",
"email":"john@example.io",
"age":36
}
TOPIC user-registration
{
"id":"38102178-dbe5-4e81-aa65-8f6df1be4d44",
"fullName":"John Doe",
"email":"john@example.io",
"age":36,
"sendAt":"1603786974956",
}
OpenAPI 3
Contract
AsyncAPI 2
Contract
apidays
Hong
Kong
AsyncAPI Anatomy
EVENT-DRIVEN APIS & APACHE KAFKA
16
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
apidays
Hong
Kong
AsyncAPI Anatomy
EVENT-DRIVEN APIS & APACHE KAFKA
17
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 include examples!
Components: Common definitions (schemas, traits, messages) like in
OpenAPI v3
apidays
Hong
Kong
Schemas as Event
Contracts
apidays
Hong
Kong
EVENT-DRIVEN APIS & APACHE KAFKA
19
Why is it important to use API contracts in Apache Kafka?
Producer
| | | | | | |  
| | | | | | |   |
| | | | | |
Apache Kafka
Send
Data
Retrieve
Data
Consumer
apidays
Hong
Kong
@hguerreroo
Contract-First API Development
EVENT-DRIVEN APIS & APACHE KAFKA
Contract-First API Development
20
Why is it important to use API contracts in Apache Kafka?
Producer
| | | | | | |  
| | | | | | |   |
| | | | | |
Apache Kafka
Send
Data
Retrieve
Data
Consumer
Consumer
Consumer
apidays
Hong
Kong
@hguerreroo
EVENT-DRIVEN APIS & APACHE KAFKA
Contract-First API Development
21
Why is it important to use API contracts in Apache Kafka?
Producer
| | | | | | |  
| | | | | | |   |
| | | | | |
Apache Kafka
Send
Data
Retrieve
Data
Consumer
Consumer
Consumer
v2
v2
v2
v1
apidays
Hong
Kong
@hguerreroo
EVENT-DRIVEN APIS & APACHE KAFKA
Contract-First API Development
22
Why is it important to use API contracts in Apache Kafka?
Producer
| | | | | | |  
| | | | | | |   |
| | | | | |
Apache Kafka
Send
Data
Retrieve
Data
Consumer
Consumer
Consumer
v2
v2
v2
v1
apidays
Hong
Kong
@hguerreroo
EVENT-DRIVEN APIS & APACHE KAFKA
Contract-First API Development
23
Why is it important to use API contracts in Apache Kafka?
Producer
| | | | | | |  
| | | | | | |   |
| | | | | |
Apache Kafka
Send
Data
Retrieve
Data
Consumer
Consumer
Consumer
v2
v2
v2
v1
apidays
Hong
Kong
@hguerreroo
What issues needs to be addressed in a Kafka
world?
▸ Kafka is not aware of data types or schema
formats.
▸ API schemas are subject to change.
▸ Central registry where the data schemas are
stored and accessible.
EVENT-DRIVEN APIS & APACHE KAFKA
24
Photo credit: Harald Groven on VisualHunt
A Registry for Event
Schemas
apidays
Hong
Kong
Using the Registry for Schema Management
EVENT-DRIVEN APIS & APACHE KAFKA
26
Producer Consumer
Deserializer
Serializer
Registry
| | | | | | |  
| | | | | | |   |
| | | | | |
Apache Kafka
Get or
Register
Schema
by Id
Retrieve
Schema
by Id
Topic B
(JSON
)
Topic C
(Protobuf)
Topic A
(Avro)
Send
Serialized
Data
Retrieve
Serialized
Data
apidays
Hong
Kong
@hguerreroo
EVENT-DRIVEN APIS & APACHE KAFKA
What are the required
capabilities of the registry?
27
The registry needs to address the
following 3 pillars for a successful
management
@hguerreroo
You need to be able to manage all the different types
of artifacts, be able to browse, download and
document in single place.
Artifact Management
Support for different types of data structures, like
Apache Avro, Google Protocol Buffers, or JSON
Schemas.
Data Formats
Artifacts follow content evolution and are controlled
by enabling content rules, including Validity and
Compatibility.
Versioning
apidays
Hong
Kong
EVENT-DRIVEN APIS & APACHE KAFKA
Registry
28
Use Cases
Source:
https://github.com/Apicurio/apicurio-registry
API specification registry for
API consumers
Shared Data Types
API Designs
Shared data types (schemas)
across
API and event driven architectures
Schema Registry
Schema registry for Kafka
serializers/deserializers
apidays
Hong
Kong
▸ Implementation preview of the CNCF
Schema Registry API.
▸ Part of the CloudEvents Working Group
efforts for standardization and
interoperability.
EVENT-DRIVEN APIS & APACHE KAFKA
CNCF’s Schema Registry API
29
CNCF Schema Registry API support
Source:
https://github.com/cloudevents/spec/blob/master/schemaregistry/schemaregistry.md
apidays
Hong
Kong
▸ Getting Started
● https://developers.redhat.com/blog/2019/12/16/getting-started-with-red-hat-integration-service-registry
● https://developers.redhat.com/blog/2020/12/09/new-features-and-storage-options-in-red-hat-integration-service-registry-1
-1-ga
▸ Install and configure Service Registry for AMQ Streams
● Installing Service Registry from the OpenShift OperatorHub
● Configuring Service Registry with AMQ Streams storage on OpenShift
▸ Validating Schemas using Kafka Client Serializer/Deserializer
● Validating schemas using Kafka client serializers/deserializers
● Strategies to look up a schema
▸ Service Registry Java Client
● Managing Service Registry content using the Java client
EVENT-DRIVEN APIS & APACHE KAFKA
Useful Bookmarks
30
apidays
Hong
Kong
@hguerreroo
linkedin.com/company/red-hat
youtube.com/user/RedHatVideos
facebook.com/redhatinc
twitter.com/RedHat
Hugo Guerrero
Twitter: @hguerreroo
https://www.youtube.com/user/hguerreroo
https://developers.redhat.com/author/hugo-guerrero
Thank You

More Related Content

PDF
apidays LIVE New York 2021 - API design is where culture and tech meet each o...
PDF
apidays LIVE Paris 2021 - API Attack Simulator - Find your API vulnerabilitie...
PDF
apidays LIVE Paris - Potential of API integrations, common traps and advices ...
PDF
INTERFACE, by apidays - Aligning teams and strategies behind API investment ...
PPTX
apidays LIVE New York 2021 - API Security & AI by Deb Roy, Accenture
PDF
apidays LIVE Paris 2021 - Beyond API Governance: Run your API org like a lean...
PDF
apidays LIVE Paris 2021 - Addressing OWASP API Security Top 10 by Isabelle Ma...
PDF
APIdays Paris 2019 - Zero Downtime in API Management by Waldemar Rosenfeld, A...
apidays LIVE New York 2021 - API design is where culture and tech meet each o...
apidays LIVE Paris 2021 - API Attack Simulator - Find your API vulnerabilitie...
apidays LIVE Paris - Potential of API integrations, common traps and advices ...
INTERFACE, by apidays - Aligning teams and strategies behind API investment ...
apidays LIVE New York 2021 - API Security & AI by Deb Roy, Accenture
apidays LIVE Paris 2021 - Beyond API Governance: Run your API org like a lean...
apidays LIVE Paris 2021 - Addressing OWASP API Security Top 10 by Isabelle Ma...
APIdays Paris 2019 - Zero Downtime in API Management by Waldemar Rosenfeld, A...

What's hot (20)

PPTX
API Management - Practical Enterprise Implementation Experience
PPTX
Deep-Dive: Secure API Management
PPTX
APIs for... Your Mom
PDF
How Apigee Api Management Platform Helps with Digital Excellence
PDF
apidays LIVE Paris 2021 - Synchronous Communication Patterns by Sébastien Ber...
PPTX
apidays LIVE New York 2021 - APIOps: automating API operations for speed and ...
PPTX
Executing on API Developer Experience
PDF
Building an API Security Strategy
PPTX
apidays LIVE India - 10 steps to secure your API by Pabitra Kumar Sahoo, Qual...
PPTX
Adapt or Die Sydney - API Security
PDF
apidays LIVE Paris 2021 - Deliver real-time data to customer using Streaming ...
PDF
apidays LIVE Paris 2021 - Taming the beast by Markus Mueller, Apiida
PDF
Contract {Collaboration} Driven Development - APIdays Interface 2020
DOCX
API Strategy in Cloud
PDF
apidays LIVE Paris 2021 - Low-Code API DevOps approach to API Lifecycle Manag...
PDF
Mobile - Your API Security Blindspot by David Stewart, Approov
PDF
apidays LIVE Paris - Avoid Building a Microservices Death Star by Przemek Kulik
PDF
Apigee and Accenture Webcast - Accenture Technology Vision 2013 - An API Cent...
PDF
INTERFACE, by apidays - Playing with FHIR: Hacking FHIR and mHealth APIs by ...
PPTX
apidays LIVE New York 2021 - Top 10 API security threats every API team shoul...
API Management - Practical Enterprise Implementation Experience
Deep-Dive: Secure API Management
APIs for... Your Mom
How Apigee Api Management Platform Helps with Digital Excellence
apidays LIVE Paris 2021 - Synchronous Communication Patterns by Sébastien Ber...
apidays LIVE New York 2021 - APIOps: automating API operations for speed and ...
Executing on API Developer Experience
Building an API Security Strategy
apidays LIVE India - 10 steps to secure your API by Pabitra Kumar Sahoo, Qual...
Adapt or Die Sydney - API Security
apidays LIVE Paris 2021 - Deliver real-time data to customer using Streaming ...
apidays LIVE Paris 2021 - Taming the beast by Markus Mueller, Apiida
Contract {Collaboration} Driven Development - APIdays Interface 2020
API Strategy in Cloud
apidays LIVE Paris 2021 - Low-Code API DevOps approach to API Lifecycle Manag...
Mobile - Your API Security Blindspot by David Stewart, Approov
apidays LIVE Paris - Avoid Building a Microservices Death Star by Przemek Kulik
Apigee and Accenture Webcast - Accenture Technology Vision 2013 - An API Cent...
INTERFACE, by apidays - Playing with FHIR: Hacking FHIR and mHealth APIs by ...
apidays LIVE New York 2021 - Top 10 API security threats every API team shoul...
Ad

Similar to apidays LIVE Hong Kong 2021 - Event-driven APIs & Schema governance for Apache Kafka by Hugo Guerrero, Red Hat (20)

PDF
Apicurio Registry: Event-driven APIs & Schema governance for Apache Kafka | F...
PDF
apidays LIVE London 2021 - Getting started with Event-Driven APIs by Hugo Gue...
PDF
apidays LIVE Paris 2021 - Getting started with Event-Driven APis by Hugo Guer...
PDF
Apache Kafka and API Management / API Gateway – Friends, Enemies or Frenemies?
PDF
Apache Kafka and API Management / API Gateway – Friends, Enemies or Frenemies...
PDF
Speed-Up Kafka Delivery with AsyncAPI & Microcks | Hugo Guerrero, Red Hat
PDF
Wikipedia’s Event Data Platform, Or: JSON Is Okay Too With Andrew Otto | Curr...
PPTX
Mulesoft lisbon_meetup_asyncapis
PDF
Automated Apache Kafka Mocking and Testing with AsyncAPI | Hugo Guerrero, Red...
PPTX
11th Manila MuleSoft Meetup Dec 2021
PDF
Building API data products on top of your real-time data infrastructure
PPTX
Building Event-Driven Systems with Apache Kafka
PPTX
Event Driven Architectures with Apache Kafka
PDF
apidays Dubai & Middle East 2023 - Combining APIs and Events, Richard Bosch, ...
PPTX
apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...
PDF
Event driven-arch
PDF
Building Event Driven (Micro)services with Apache Kafka
PDF
Designing Payloads for Event-Driven Systems | Lorna Mitchell, Aiven
PDF
Kafka Vienna Meetup 020719
PDF
Apidays Paris 2023 - Boosting Event-Driven Development with AsyncAPI and Micr...
Apicurio Registry: Event-driven APIs & Schema governance for Apache Kafka | F...
apidays LIVE London 2021 - Getting started with Event-Driven APIs by Hugo Gue...
apidays LIVE Paris 2021 - Getting started with Event-Driven APis by Hugo Guer...
Apache Kafka and API Management / API Gateway – Friends, Enemies or Frenemies?
Apache Kafka and API Management / API Gateway – Friends, Enemies or Frenemies...
Speed-Up Kafka Delivery with AsyncAPI & Microcks | Hugo Guerrero, Red Hat
Wikipedia’s Event Data Platform, Or: JSON Is Okay Too With Andrew Otto | Curr...
Mulesoft lisbon_meetup_asyncapis
Automated Apache Kafka Mocking and Testing with AsyncAPI | Hugo Guerrero, Red...
11th Manila MuleSoft Meetup Dec 2021
Building API data products on top of your real-time data infrastructure
Building Event-Driven Systems with Apache Kafka
Event Driven Architectures with Apache Kafka
apidays Dubai & Middle East 2023 - Combining APIs and Events, Richard Bosch, ...
apidays LIVE India - Asynchronous and Broadcasting APIs using Kafka by Rohit ...
Event driven-arch
Building Event Driven (Micro)services with Apache Kafka
Designing Payloads for Event-Driven Systems | Lorna Mitchell, Aiven
Kafka Vienna Meetup 020719
Apidays Paris 2023 - Boosting Event-Driven Development with AsyncAPI and Micr...
Ad

More from apidays (20)

PDF
apidays Munich 2025 - The Physics of Requirement Sciences Through Application...
PDF
apidays Munich 2025 - Developer Portals, API Catalogs, and Marketplaces, Miri...
PDF
apidays Munich 2025 - Making Sense of AI-Ready APIs in a Buzzword World, Andr...
PDF
apidays Munich 2025 - Integrate Your APIs into the New AI Marketplace, Senthi...
PDF
apidays Munich 2025 - The Double Life of the API Product Manager, Emmanuel Pa...
PDF
apidays Munich 2025 - Let’s build, debug and test a magic MCP server in Postm...
PDF
apidays Munich 2025 - The life-changing magic of great API docs, Jens Fischer...
PDF
apidays Munich 2025 - Automating Operations Without Reinventing the Wheel, Ma...
PDF
apidays Munich 2025 - Geospatial Artificial Intelligence (GeoAI) with OGC API...
PPTX
apidays Munich 2025 - GraphQL 101: I won't REST, until you GraphQL, Surbhi Si...
PPTX
apidays Munich 2025 - Effectively incorporating API Security into the overall...
PPTX
apidays Munich 2025 - Federated API Management and Governance, Vince Baker (D...
PPTX
apidays Munich 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (Aavista Oy)
PPTX
apidays Munich 2025 - Streamline & Secure LLM Traffic with APISIX AI Gateway ...
PPTX
apidays Munich 2025 - Building Telco-Aware Apps with Open Gateway APIs, Subhr...
PPTX
apidays Munich 2025 - Building an AWS Serverless Application with Terraform, ...
PDF
apidays Helsinki & North 2025 - REST in Peace? Hunting the Dominant Design fo...
PDF
apidays Helsinki & North 2025 - Monetizing AI APIs: The New API Economy, Alla...
PDF
apidays Helsinki & North 2025 - How (not) to run a Graphql Stewardship Group,...
PDF
apidays Helsinki & North 2025 - APIs in the healthcare sector: hospitals inte...
apidays Munich 2025 - The Physics of Requirement Sciences Through Application...
apidays Munich 2025 - Developer Portals, API Catalogs, and Marketplaces, Miri...
apidays Munich 2025 - Making Sense of AI-Ready APIs in a Buzzword World, Andr...
apidays Munich 2025 - Integrate Your APIs into the New AI Marketplace, Senthi...
apidays Munich 2025 - The Double Life of the API Product Manager, Emmanuel Pa...
apidays Munich 2025 - Let’s build, debug and test a magic MCP server in Postm...
apidays Munich 2025 - The life-changing magic of great API docs, Jens Fischer...
apidays Munich 2025 - Automating Operations Without Reinventing the Wheel, Ma...
apidays Munich 2025 - Geospatial Artificial Intelligence (GeoAI) with OGC API...
apidays Munich 2025 - GraphQL 101: I won't REST, until you GraphQL, Surbhi Si...
apidays Munich 2025 - Effectively incorporating API Security into the overall...
apidays Munich 2025 - Federated API Management and Governance, Vince Baker (D...
apidays Munich 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (Aavista Oy)
apidays Munich 2025 - Streamline & Secure LLM Traffic with APISIX AI Gateway ...
apidays Munich 2025 - Building Telco-Aware Apps with Open Gateway APIs, Subhr...
apidays Munich 2025 - Building an AWS Serverless Application with Terraform, ...
apidays Helsinki & North 2025 - REST in Peace? Hunting the Dominant Design fo...
apidays Helsinki & North 2025 - Monetizing AI APIs: The New API Economy, Alla...
apidays Helsinki & North 2025 - How (not) to run a Graphql Stewardship Group,...
apidays Helsinki & North 2025 - APIs in the healthcare sector: hospitals inte...

Recently uploaded (20)

PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Cloud computing and distributed systems.
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
KodekX | Application Modernization Development
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Encapsulation theory and applications.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
cuic standard and advanced reporting.pdf
PDF
Modernizing your data center with Dell and AMD
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
MYSQL Presentation for SQL database connectivity
Cloud computing and distributed systems.
Dropbox Q2 2025 Financial Results & Investor Presentation
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
KodekX | Application Modernization Development
Understanding_Digital_Forensics_Presentation.pptx
Big Data Technologies - Introduction.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
NewMind AI Monthly Chronicles - July 2025
Encapsulation theory and applications.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
20250228 LYD VKU AI Blended-Learning.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Encapsulation_ Review paper, used for researhc scholars
cuic standard and advanced reporting.pdf
Modernizing your data center with Dell and AMD
Diabetes mellitus diagnosis method based random forest with bat algorithm
Per capita expenditure prediction using model stacking based on satellite ima...

apidays LIVE Hong Kong 2021 - Event-driven APIs & Schema governance for Apache Kafka by Hugo Guerrero, Red Hat

  • 1. August 26, 2021 Event-driven APIs & Apache Kafka Hugo Guerrero APIs & Messaging Developer Advocate Red Hat
  • 2. Hugo Guerrero Mexican @ MA, USA APIs & Event-Driven Specialist | Open Source Advocate | History, Travel & Food Enthusiast @hguerreroo apidays Hong Kong Agenda Event-driven APIs Event-driven development Kafkaesque Challenges Contract-First The REST of the World AsyncAPI Spec Event Schemas Schemas as Contracts Registry for Schemas
  • 3. Event-driven APIs & Modern Applications apidays Hong Kong
  • 4. What is the situation? EVENT-DRIVEN APIS & APACHE KAFKA 4 @hguerreroo Distributed Decoupled Highly Connected apidays Hong Kong
  • 5. What is the situation? EVENT-DRIVEN APIS & APACHE KAFKA 5 @hguerreroo Distributed Decoupled Highly Connected Microservices Request / Response Events apidays Hong Kong
  • 6. What is the situation? EVENT-DRIVEN APIS & APACHE KAFKA 6 @hguerreroo Distributed Decoupled Highly Connected Microservices Request / Response Events apidays Hong Kong Events
  • 7. The Traditional Workflow EVENT-DRIVEN APIS & APACHE KAFKA 7 Project Planning The business experts spend time writing up a project plan for a series of services and potentially a user interface Send to Developers The various development teams attempt to interpret the project plan and implement their code so that they are compatible Iterate and Integrate The developer teams iteratively try to resolve integration issues and spend loads of time ensuring compatibility apidays Hong Kong
  • 8. Kafkaesque EVENT-DRIVEN APIS & APACHE KAFKA 8 Photo credit: dbeck03 on VisualHunt ENDPOINT DOCUMENTATION ? DATA FORMAT AND VALIDATION ? MIS-UNDERSTANDING
  • 9. Kafkaesque EVENT-DRIVEN APIS & APACHE KAFKA 9 Photo credit: dbeck03 on VisualHunt INFRASTRUCTURE ACCESS ? PUBLISHERS & CONSUMERS COMPLIANCE ? EVENTS AVAILABILITY ? SLOW TIME TO MARKET, POOR QUALITY
  • 10. Event-Driven APIs and Contract-First Workflows apidays Hong Kong
  • 11. EVENT-DRIVEN APIS & APACHE KAFKA 11 Why Contract-First? @hguerreroo ▸ Because you want to allow people to work independently ▸ Because you want to ensure consistency ▸ Because you need strong guarantees about service contracts ▸ Because you, your team, your customers, and your partners can collaborate ▸ Because you can save time by using code generators and testing tooling apidays Hong Kong
  • 12. How does it work on REST APIs? EVENT-DRIVEN APIS & APACHE KAFKA 12 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. apidays Hong Kong
  • 13. Event-driven Secret Weapon EVENT-DRIVEN APIS & APACHE KAFKA 13 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 AsyncAPI https://www.asyncapi.com/ apidays Hong Kong
  • 14. AsyncAPI EVENT-DRIVEN APIS & APACHE KAFKA 14 asyncapi.org apidays Hong Kong Protocol agnostic: ▸ AMQP ▸ MQTT ▸ NATS ▸ HTTP ▸ WebSockets ▸ Kafka ▸ STOMP ▸ JMS Open Source Tooling: ▸ Online playground (playground.asyncapi.org) ▸ Code generators ▸ Documentation generators ▸ Editors ▸ Mocking ▸ Testing
  • 15. Unified API contracts EVENT-DRIVEN APIS & APACHE KAFKA 15 @hguerreroo POST /register { "fullName":"John Doe", "email":"john@example.io", "age":36 } TOPIC user-registration { "id":"38102178-dbe5-4e81-aa65-8f6df1be4d44", "fullName":"John Doe", "email":"john@example.io", "age":36, "sendAt":"1603786974956", } OpenAPI 3 Contract AsyncAPI 2 Contract apidays Hong Kong
  • 16. AsyncAPI Anatomy EVENT-DRIVEN APIS & APACHE KAFKA 16 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 apidays Hong Kong
  • 17. AsyncAPI Anatomy EVENT-DRIVEN APIS & APACHE KAFKA 17 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 include examples! Components: Common definitions (schemas, traits, messages) like in OpenAPI v3 apidays Hong Kong
  • 19. EVENT-DRIVEN APIS & APACHE KAFKA 19 Why is it important to use API contracts in Apache Kafka? Producer | | | | | | |   | | | | | | |   | | | | | | | Apache Kafka Send Data Retrieve Data Consumer apidays Hong Kong @hguerreroo Contract-First API Development
  • 20. EVENT-DRIVEN APIS & APACHE KAFKA Contract-First API Development 20 Why is it important to use API contracts in Apache Kafka? Producer | | | | | | |   | | | | | | |   | | | | | | | Apache Kafka Send Data Retrieve Data Consumer Consumer Consumer apidays Hong Kong @hguerreroo
  • 21. EVENT-DRIVEN APIS & APACHE KAFKA Contract-First API Development 21 Why is it important to use API contracts in Apache Kafka? Producer | | | | | | |   | | | | | | |   | | | | | | | Apache Kafka Send Data Retrieve Data Consumer Consumer Consumer v2 v2 v2 v1 apidays Hong Kong @hguerreroo
  • 22. EVENT-DRIVEN APIS & APACHE KAFKA Contract-First API Development 22 Why is it important to use API contracts in Apache Kafka? Producer | | | | | | |   | | | | | | |   | | | | | | | Apache Kafka Send Data Retrieve Data Consumer Consumer Consumer v2 v2 v2 v1 apidays Hong Kong @hguerreroo
  • 23. EVENT-DRIVEN APIS & APACHE KAFKA Contract-First API Development 23 Why is it important to use API contracts in Apache Kafka? Producer | | | | | | |   | | | | | | |   | | | | | | | Apache Kafka Send Data Retrieve Data Consumer Consumer Consumer v2 v2 v2 v1 apidays Hong Kong @hguerreroo
  • 24. What issues needs to be addressed in a Kafka world? ▸ Kafka is not aware of data types or schema formats. ▸ API schemas are subject to change. ▸ Central registry where the data schemas are stored and accessible. EVENT-DRIVEN APIS & APACHE KAFKA 24 Photo credit: Harald Groven on VisualHunt
  • 25. A Registry for Event Schemas apidays Hong Kong
  • 26. Using the Registry for Schema Management EVENT-DRIVEN APIS & APACHE KAFKA 26 Producer Consumer Deserializer Serializer Registry | | | | | | |   | | | | | | |   | | | | | | | Apache Kafka Get or Register Schema by Id Retrieve Schema by Id Topic B (JSON ) Topic C (Protobuf) Topic A (Avro) Send Serialized Data Retrieve Serialized Data apidays Hong Kong @hguerreroo
  • 27. EVENT-DRIVEN APIS & APACHE KAFKA What are the required capabilities of the registry? 27 The registry needs to address the following 3 pillars for a successful management @hguerreroo You need to be able to manage all the different types of artifacts, be able to browse, download and document in single place. Artifact Management Support for different types of data structures, like Apache Avro, Google Protocol Buffers, or JSON Schemas. Data Formats Artifacts follow content evolution and are controlled by enabling content rules, including Validity and Compatibility. Versioning apidays Hong Kong
  • 28. EVENT-DRIVEN APIS & APACHE KAFKA Registry 28 Use Cases Source: https://github.com/Apicurio/apicurio-registry API specification registry for API consumers Shared Data Types API Designs Shared data types (schemas) across API and event driven architectures Schema Registry Schema registry for Kafka serializers/deserializers apidays Hong Kong
  • 29. ▸ Implementation preview of the CNCF Schema Registry API. ▸ Part of the CloudEvents Working Group efforts for standardization and interoperability. EVENT-DRIVEN APIS & APACHE KAFKA CNCF’s Schema Registry API 29 CNCF Schema Registry API support Source: https://github.com/cloudevents/spec/blob/master/schemaregistry/schemaregistry.md apidays Hong Kong
  • 30. ▸ Getting Started ● https://developers.redhat.com/blog/2019/12/16/getting-started-with-red-hat-integration-service-registry ● https://developers.redhat.com/blog/2020/12/09/new-features-and-storage-options-in-red-hat-integration-service-registry-1 -1-ga ▸ Install and configure Service Registry for AMQ Streams ● Installing Service Registry from the OpenShift OperatorHub ● Configuring Service Registry with AMQ Streams storage on OpenShift ▸ Validating Schemas using Kafka Client Serializer/Deserializer ● Validating schemas using Kafka client serializers/deserializers ● Strategies to look up a schema ▸ Service Registry Java Client ● Managing Service Registry content using the Java client EVENT-DRIVEN APIS & APACHE KAFKA Useful Bookmarks 30 apidays Hong Kong @hguerreroo