Leverage API Management To Best Implement Event Driven Architectures Digital
Leverage API Management To Best Implement Event Driven Architectures Digital
to best implement
Event-Driven Architectures
How API Management can bridge the gaps and eliminate the pains
associated with managing synchronous and event-driven APIs
Table of Contents
2 Introduction: modernization is imminent
4 A brief overview of APIs and EDA
- Recent trends in the adoption of APIs
- EDA explained
- Brokers, producers, and consumers
Securing everything
14 Conclusion
Introduction:
Modernization
is imminent
2
Consumer demands are changing. Whether it be expectations around no
downtime, real-time, accurate data, or connected experiences, organizations
now have a new benchmark for what it means to be a winner in today’s digital
economy. And this applies to both B2B and B2C providers.
z Ridesharing ETA
While the shift towards EDA is one that organizations should embrace, it does
come with its own sets of pains and challenges associated with managing,
securing, and governing the synchronous and asynchronous APIs that will
typically undergird event-driven systems. This whitepaper is meant to help
teams figure out how they can eliminate those pains. We’ll cover:
3
A brief overview of APIs and EDA
API stands for Application Programming Interface. An application can interact
with another application—invoke actions, query for data, and so on—through
an API. An API enables communication between applications while not
exposing the internal logic or implementation of the applications. When two
applications are developed by different developers, teams, or organizations,
APIs are especially important. APIs are the only way to ensure that complex
systems can interoperate.
And the market has responded to these trends. For example, the API
Management market is expected to grow by about 35% by 2025. And, at the
time of this writing, the ProgrammableWeb API directory listed nearly 25,000
public APIs. In addition to the already-existing private APIs and partner APIs.
EDA explained
Event-driven architecture (EDA) is an architectural paradigm that
emphasizes indirect interaction between components. This approach is
often very useful for use cases that require real-time data stream processing
and notifications. Event-driven architectures satisfy these use cases due to
two key characteristics:
4
z Asynchronous communication: When component A communicates
asynchronously with component B, component A is not blocked from
continuing its work while it waits for a response from component B.
Producers are components that produce (or “send” or “publish”, which are all
synonymous terms in EDA) messages (or “events”) to the message broker.
Consumers are components that consume or handle messages received by
the message broker.
5
SI NG LE R ESPONSE VERSUS A STR E AM OF E VENTS
Traditional APIs have exactly one response per request. Even if the response
is empty, the fact that the call returned is considered a response. Consumers
of an event-driven API will receive a stream of events that are not tied to any
specific call.
Event-driven APIs are not blocking. When a consumer subscribes for some
events, and no event arrives, then the consumer can’t tell if there is a problem
on the other side or if there simply are no events to handle. To detect backend
problems, best practices for event-driven APIs include health checks and
keepalive signals.
z The client doesn’t receive events in real time. The longer the polling period,
the longer the delay between the occurrence of an event and its processing.
z If the polling period is very short, then the caller may call for events too
often, when there aren’t any new events available. This can lead to wasted
resources, and the costs would multiply in the case of multiple consumers.
6
How to leverage API Management and
API Security to help ease event-driven
modernization initiatives
The shift towards event-driven architectures has many implications across
business and technical teams, and individuals from CTOs, to Architects, to
Developers now have a large set of new requirements on their plates. The
impacts will be felt intensely when trying to figure out new ways to manage
and secure API and Event landscapes as these kinds of architectures call for a
shift towards new protocols, query technologies, and backend services.
Realistically, the vast majority of organizations will still have to maintain and
support certain API ecosystems across the business built on more traditional
protocols. As a result, organizations now find themselves asking:
API Management and Gateway solutions have existed for a long time in order
to ensure that APIs are available and accessed securely and reliably. External
requesters of your system interact with the API gateway, which functions
analogously to a front-of-house security guard. The only entity that interacts
with the underlying services is the API gateway. The use of an API gateway can
significantly reduce the overall complexity and potential security vulnerabilities
of the system through application of methods such as data logging masking,
traffic shaping, authentication, usage contracts, policy application, and more.
7
While this all sounds great and obviously worth implementing, the trouble
comes when organizations who are trying to modernize and make the move to
event-driven systems find themselves asking:
The way forward for API-first organizations who also want to implement
event-driven architectures and systems is to either build or invest in API
Management and Gateway solutions that can manage both synchronous
and event-driven APIs. These solutions would leverage advanced protocol
mediation so that teams could apply the many benefits of an API Gateway to
traditional synchronous relationships as well as synchronous to asynchronous
relationships and asynchronous to asynchronous relationships.
Since the world has already heard plenty on how to manage fully synchronous
API ecosystems, let’s explore examples of how API Management solutions
can be used to manage synchronous to asynchronous systems and fully
asynchronous systems.
8
Let’s take an example of an organization who has client-side REST-based
applications and are implementing Kafka as pub-sub at the backend for real-
time messaging and stream processing. Here are the multiple use cases that
their modern Gateway and API Management solution could enable:
9
E VENT CONSUM PTI ON VIA STR E AM I NG
W ITH K AFK A AN D W EBSOCKET:
The API Gateway sits between Kafka and Websocket-driven consumer services
for true asynchronous to asynchronous communication. The data that’s passed
between the two is authenticated, quota’d, routed, and traffic shaped–all without
the need for constant HTTP polling of your Kafka backend. built on something
Kafka.
10
More than just API Management: how to
properly secure synchronous and event-driven
APIs ecosystems
Security is paramount, and APIs present a serious risk. As organizations
expose more and more critical business services via internal or external APIs,
the attack vectors naturally increase. The subsequent result is that malicious
actors and their attempts to attack your system will focus on your API layer. To
avoid this, organizations should consider two main categories of API Security
beyond the base-layer of security measures offered by your API Management
and API Gateway solutions:
z API threat protection: the practice of automating how attacks against AIs
are detected and blocked before security issues are caused.
z API Discoverability and auditing: discover andit APIs that exist in your
ecosystem and flag those that are not secured adequately given certain
standards and policies
11
z API Monitoring and alerting: monitor how APIs are being consumed in real-
time and configure notifications and alerts when malicious behavior, bots,
etc. are detected for quick isolation and remediation.
z API Firewalls and runtime policy enforcement: build a specific firewall for
securing APIs so that security policies can be applied to APIs at runtime.
Securing everything
Oftentimes, API security tooling will plug into an API Gateway in order to apply
many of their API security solutions. While this is often effective, it can present
challenges for teams who are either using multiple Gateways to manage and
govern synchronous and event-driven APIs and/or teams who might only have
robust Gateway solutions for their synchronous APIs and nothing in place for
their event-driven APIs. Because of this, we recommend that teams look for
single API Management and/or API Security solutions that can support both
synchronous and event-driven APIs.
APIs are most useful when they’re actually used. Full stop.
This means that, beyond just designing, implementing, and securing APIs, you
have to make them consumable. More often than not, APIs are consumed by
developers, both internal to your business and external via customers and/
or partners. To harvest the most value from your APIs, developers need the
ability to discover APIs and learn how to use them effectively. Investing in a
Developer Portal facilitates discovery, and it also provides a central location for
API documentation, examples, and tooling support.
Developer portals don’t just enhance visibility externally. They can also
improve internal visibility and, depending on the use case, turn complex
API ecosystems into profitable revenue generation machines. Some API
Management solutions will have Developer Portals “baked-in” whereas some
Portals and API Management solutions will simply be externally integrated.
The “baked-in” portals often provide extra benefits around analytics into
12
external or internal API consumption Revenue
generation
so that you can always keep a
“single pane of glass” view into how
your APIs are being used in the real
world. Developer portals also often example:
provide options for defining usage
plans, contracts, and creating custom Imagine you are a B2B delivery
monetization strategies so that API service that offers accurate,
consumption can begin to directly real-time delivery updates as
drive revenue generation. a service to businesses along
various points of a supply chain.
As great as Developer Portals
are, they aren’t all created equal.
You could implement event-
This can often present problems
for the organization interested
driven APIs that help you
in implementing event-driven gather information in real-
architectures and asynchronous APIs, time around traffic patterns,
as many portals offer specific support delivery fulfillment, remaining
for either synchronous (most common) stops, and speed of the vehicle
or event-driven/asynchronous APIs all asynchronously to deliver
(less common). This prevents forward-
real-time delivery estimates to
thinking organizations from “getting
customers.
the most out of” their APIs, and, for
this reason, we recommend investing
the necessary resources on either a With a proper monetization
commercial or DIY portal solution that strategy in place, this API
can support both synchronous and could exist in accordance
event-driven APIs. with a contract that says
“the consumer of this API will
pay 10 cents per every 100
times this API is called.”
13
Conclusion
Today’s systems handle more data, coming from more diverse data sources
like sensors and IoT devices in the form of events. Event-based data and real-
time processing requirements have led to a massive uptick in adopting event-
driven architecture for building systems.
14
How to Contact Us
gravitee.io/contact-us gravitee.io/demo community.gravitee.io
If you’re interested, If you’d like to skip (some of) If you want to give OSS a go,
and want to reach out, the Sales pitch and see a demo, check out our community forum,
you can contact us here you can book one of those here where you can find links to our
github repo and connect with
the folks who have driven over
350,000 Docker pulls / month
15