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
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
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

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • Serverless at Scale
  • Microservices With .NET Core: Building Scalable and Resilient Applications
  • Serverless Patterns: Web
  • This Is How You Give Good Feedback at Work

Trending

  • A Deep Dive Into Firmware Over the Air for IoT Devices
  • Agentic AI for Automated Application Security and Vulnerability Management
  • How to Perform Custom Error Handling With ANTLR
  • Concourse CI/CD Pipeline: Webhook Triggers
  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.

By 
Cameron HUNT user avatar
Cameron HUNT
·
May. 01, 23 · Analysis
Likes (2)
Comment
Save
Tweet
Share
3.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
  • Microservices With .NET Core: Building Scalable and Resilient Applications
  • Serverless Patterns: Web
  • This Is How You Give Good Feedback at Work

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • 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:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!