DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modern Digital Website Security: Prepare to face any form of malicious web activity and enable your sites to optimally serve your customers.

Containers Trend Report: Explore the current state of containers, containerization strategies, and modernizing architecture.

Low-Code Development: Learn the concepts of low code, features + use cases for professional devs, and the low-code implementation process.

E-Commerce Development Essentials: Considering starting or working on an e-commerce business? Learn how to create a backend that scales.

Related

  • Serverless at Scale
  • Serverless Patterns: Web
  • This Is How You Give Good Feedback at Work
  • Modeling Saga as a State Machine

Trending

  • Deployment of Spring MVC App on a Local Tomcat Server
  • Java 11 to 21: A Visual Guide for Seamless Migration
  • Evolution of Software Architecture: From Monoliths to Microservices and Beyond
  • Live Database Migration
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. What Are Events? API Calls

What Are Events? API Calls

We should start calling apples: apples. API calls always represent an ‘Event,’ so such invocations are best described as Events.

Cameron HUNT user avatar by
Cameron HUNT
·
May. 01, 23 · Analysis
Like (1)
Save
Tweet
Share
2.3K Views

Join the DZone community and get the full member experience.

Join For Free

It is always interesting to note how even today's Cloud giants continue to draw a largely imaginary line between Synchronous and Asynchronous HTTP Requests, such as in the case of a typical REST API call. This line, we are asked to believe, very clearly separates Synchronous Requests – where the Request is made and the caller holds the line until receiving a Response from the relevant HTTP API Endpoint – from Asynchronous Requests – where the caller fires off their Request, (typically) gets a 202 Status Code in reply, and then waits for the actual API Response via some other channel; such as a Webhook, WebSocket, or using the 'HTTP Polling' Pattern described by Microsoft in its Asynchronous Request-Reply pattern Article.

We read in this same Article that: "Most APIs can respond quickly enough for responses to arrive back over the same connection… In some scenarios, however, the work done by [the] backend may be long-running, … [and] it isn't feasible to wait for the work to complete before responding to the Request. This situation is a potential problem for any synchronous request-reply pattern… Some architectures solve this problem using a message broker to separate the request and response stages… But this separation also brings additional complexity when the client requires success notification, as this step needs to become asynchronous."

What is quite unbelievable about this text from Microsoft is that Synchronous Request-Response complexity is far lower in their analysis primarily because they fail to notice it. We are told that using a Broker "brings additional complexity when the client requires success notification, as this step needs to become asynchronous." We are not told what happens when a Synchronous API Request is made, and there is a timeout. Any idea which party is responsible for managing recovery? Any idea what happens if a second – duplicate – API call is made by the client, resulting in a duplicated resource – such as a duplicated Bank Payment – on the target system? How can the client ever know if the original API Request resulted in the creation of the requested resource in the case of a timeout or a sudden network failure? Isn't that also a complex problem to manage? Should we bother to think about it?

The reality is, instead, much different from what we have been asked to believe for the last twenty or so years. Every HTTP Request – whether Synchronous or Asynchronous – represents an 'Event' in the EDA context. Once an API Request has been received by a target system – I believe I can confidently assert without the help of any grammarian – the API has, at that moment, been 'RequestED' to perform some work. This reality is laid plain by the example I have just given of a timeout: it is most often the case that the target system will do the work that was 'Requested' of it by the Synchronous API call, regardless of the fact that the caller never receives a (Synchronous) Response confirming that the work was successfully performed.

For all the reasons just mentioned, I believe we should start calling apples, apples. API calls always represent an 'Event,' so those invocations should, as such, always be represented in exactly that format using the 'Requested (R7D) Event Pattern' that I proposed two years ago. Anyone taking the few minutes necessary to read about this Pattern will also learn that it offers a very significant benefit that is completely unavailable to us when using an 'old school' Request-Response approach, whether Synchronous or Asynchronous.

API Architecture Message broker Event Moment Requests

Opinions expressed by DZone contributors are their own.

Related

  • Serverless at Scale
  • Serverless Patterns: Web
  • This Is How You Give Good Feedback at Work
  • Modeling Saga as a State Machine

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: