Synchronous vs Asynchronous API Communication
Key Points
- Synchronous communication occurs when a user initiates an action (e.g., checking balance or updating address) and waits for an immediate response from the app.
- Asynchronous communication lets the system notify the user independently of a request (e.g., alerts about suspicious activity) so timely action can be taken.
- Event‑driven integration patterns such as webhook callbacks and publish‑subscribe messaging provide efficient ways to handle asynchronous interactions.
- Apache Kafka is a leading open‑source event‑streaming platform where producers publish events to topics that consumer applications (like a mobile banking app) subscribe to for real‑time data.
- The AsyncAPI specification defines message‑driven, protocol‑agnostic API flows, enabling consistent design and documentation of asynchronous APIs.
Sections
Full Transcript
# Synchronous vs Asynchronous API Communication **Source:** [https://www.youtube.com/watch?v=3ij-rga08H4](https://www.youtube.com/watch?v=3ij-rga08H4) **Duration:** 00:07:09 ## Summary - Synchronous communication occurs when a user initiates an action (e.g., checking balance or updating address) and waits for an immediate response from the app. - Asynchronous communication lets the system notify the user independently of a request (e.g., alerts about suspicious activity) so timely action can be taken. - Event‑driven integration patterns such as webhook callbacks and publish‑subscribe messaging provide efficient ways to handle asynchronous interactions. - Apache Kafka is a leading open‑source event‑streaming platform where producers publish events to topics that consumer applications (like a mobile banking app) subscribe to for real‑time data. - The AsyncAPI specification defines message‑driven, protocol‑agnostic API flows, enabling consistent design and documentation of asynchronous APIs. ## Sections - [00:00:00](https://www.youtube.com/watch?v=3ij-rga08H4&t=0s) **Untitled Section** - ## Full Transcript
to understand async API and why it's
important we first have to talk about
two key Concepts
those include synchronous communication
and asynchronous communication
let's say you just downloaded a mobile
app let's take a mobile banking app for
this example there are two sides that
make up a great user experience
first Sometimes you want to engage the
app
let's say it's that time of the month to
pay your bill and you need to make sure
that you have enough money in your
account to cover it
so
you go into your account
and you view your current balance you'd
expect
a response
that's an answer to your question so
you're asking the app what's my current
balance
let's say
that answer was
five hundred dollars
let's also say you just moved into a new
place and you need to update your
mailing address with your bank so again
you go into your app
you go to Account Details and you update
your address again your
asking the app to update your address
and you'd expect a response confirming
that change was made
so your address same
in this situation this represents
synchronous communication because both
the application and the user are engaged
at the same time
other times the app wants to engage you
so you open up your phone and you go to
your you go to your mobile banking app
and you see that there was a
notification of
suspicious activity
detected on your account
so there was a transaction on a remote
system
and this information was shared with the
user it's really important in this
situation for the user to be notified as
soon as something happens so that they
can act quickly
you wouldn't want to have to go into
your account every day to see if it's
safe and secure you just want a need to
be told when your account might be at
risk
so for this situation since the
application and the user do not have to
be engaged at the same time it
represents asynchronous communication
event-based approaches to integration
like webhook callbacks or publish
subscribe messaging Solutions are a more
efficient way to facilitating
asynchronous interactions
Apache Kafka has emerged as a leading
open source event streaming platform
with Apache Kafka
streams of events
are published
to topics
that consuming applications like our
mobile banking app can subscribe
directly to
for real-time access
to business critical data
and there are many uses for
Apache Kafka
take our mobile banking app example
let's say they send you a personalized
promotional offer
based off of your account exceeding a
certain limit
or that you engaged in a level of of
high spending that's a perfect example
where it could be used
so now that we have this understanding
of both synchronous communication and
asynchronous communication we can bring
async API back into the picture
to understand what it is and and how
it's useful so the async API
specification is used to describe
message driven API flows it's protocol
agnostic so you can use it for apis
that use any asynchronous protocol
for our situation
were
were using it as a specification to
describe events on Kafka topics
and this is really important because
it's much like
an open API
which is used as a standard for
describing
apis
events they they must be described in a
way that captures enough information so
that the user can make good use of it so
essentially so you can build those Ultra
responsive applications
that we we talked about earlier
but it doesn't stop it being described
events they also have to be
discoverable
and when they're described it not only
includes technical information but also
vital business contacts as well
so coming full circle
we can use async API specification as a
standard to describe events and we can
use that
when we do API management
good API management
when we're managing events across the
Enterprise
thank you if you like this video and
want to see more like it please like And
subscribe if you have questions please
drop them in the comments below