Dependency Injection Framework for Asynchronous Backend Calls
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Synchronous interactions between clients and multiple backend systems in server-side enterprise applications lead to increased response times and blocked server resources, affecting overall throughput.
Innovation Solution
A dependency injection (DI) framework is used to determine dependencies of a response object, invoke services for retrieving dependency objects, and orchestrate asynchronous concurrent calls, allowing for non-blocking operations with a return type resolution component and asynchronous qualifier to manage timeouts.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Speed
If synchronous interactions are used between clients and backend systems, then code simplicity is maintained, but response time increases and server resources are blocked
Solution Approach 1:
The patent introduces a mediator layer (service layer with reactive objects) between the client and backend systems. This mediator handles asynchronous communication, allowing the client to send requests and continue execution without blocking, while the mediator manages the asynchronous responses from multiple backend systems.
Solution Approach 2:
The patent implements dynamic behavior by allowing server threads to be released after initiating asynchronous calls and reused for other tasks. The system dynamically adapts thread usage based on whether calls are synchronous or asynchronous, improving resource utilization and response time.
2Productivity
If synchronous calls are made to multiple backend systems, then resource usage is simple to manage, but throughput decreases due to blocked threads
Solution Approach 1:
The reactive objects automatically manage their own lifecycle and execution flow. When a service method is called on a reactive object, it automatically executes the associated asynchronous operation and manages the response, eliminating the need for manual thread management and complex orchestration code.
Solution Approach 2:
The patent merges multiple asynchronous operations into a single coordinated response by combining the results of multiple reactive objects. The framework automatically waits for all dependent reactive objects to complete and then combines their results, simplifying the orchestration of multiple backend calls.
3Productivity
If asynchronous concurrent calls are implemented, then system throughput improves, but code complexity increases
Solution Approach 1:
The reactive object serves as an intermediary that simplifies asynchronous code. Instead of writing complex callback chains or promise management code, developers work with reactive objects that encapsulate the asynchronous logic, making the code more readable and maintainable while still achieving high throughput.
4Speed
If synchronous resource allocation is used, then resource management is straightforward, but response time increases due to blocked threads
Solution Approach 1:
The system dynamically adjusts resource allocation based on the type of call. For asynchronous calls, threads are released back to the pool after initiating the operation, allowing them to be reused immediately. This dynamic resource management improves response time while the framework automatically handles the complexity of thread pool management.
Data Source
AI summary
In accordance with an embodiment, described herein is a system and method for supporting a reactive response using a dependency injection (DI) framework. The DI framework can determine the dependencies of a response object, and invoke a plurality of services for retrieving dependency objects from backend systems to satisfy those dependencies. Each service can return a reactive object, which the DI framework can match to a dependency object, thereby enabling the DI framework to orchestrate asynchronous concurrent calls to the services on behalf of an application. Each reactive object can be used to retrieve a corresponding dependency object at a later time. The DI framework can use the dependency object to compose the response object and inject the response object to an application at the server environment.


