|
ORE Studio 0.0.4
|
Thread-safe map for tracking pending requests by correlation ID. More...
#include <pending_request_map.hpp>

Public Member Functions | |
| pending_request_map (boost::asio::any_io_executor executor) | |
| std::shared_ptr< response_channel > | register_request (std::uint32_t correlation_id) |
| Register a new pending request. | |
| bool | complete (std::uint32_t correlation_id, messaging::frame response) |
| Complete a pending request with a response. | |
| bool | fail (std::uint32_t correlation_id, messaging::error_code ec) |
| Fail a specific pending request with an error. | |
| void | fail_all (messaging::error_code ec) |
| Fail all pending requests with an error. | |
| void | remove (std::uint32_t correlation_id) |
| Remove a completed/cancelled request from the map. | |
| std::size_t | size () const |
| Get the number of pending requests. | |
| bool | empty () const |
| Check if there are any pending requests. | |
Thread-safe map for tracking pending requests by correlation ID.
Used by the client to match incoming responses to their originating requests. When a request is sent, a response_channel is registered with its correlation ID. When a response arrives, the message loop looks up the channel by correlation ID and delivers the response.
| std::shared_ptr< response_channel > register_request | ( | std::uint32_t | correlation_id | ) |
Register a new pending request.
Creates a response_channel for the given correlation ID. The caller should co_await the returned channel's get() method.
| correlation_id | The correlation ID for this request |
| bool complete | ( | std::uint32_t | correlation_id, |
| messaging::frame | response | ||
| ) |
Complete a pending request with a response.
Called by the message loop when a response frame arrives. Delivers the response to the waiting coroutine.
| correlation_id | The correlation ID from the response |
| response | The response frame |
| bool fail | ( | std::uint32_t | correlation_id, |
| messaging::error_code | ec | ||
| ) |
Fail a specific pending request with an error.
Called on timeout for a specific request.
| correlation_id | The correlation ID to fail |
| ec | The error code |
| void fail_all | ( | messaging::error_code | ec | ) |
Fail all pending requests with an error.
Called when connection is lost - fails all waiting requests.
| ec | The error code to deliver to all pending requests |
| void remove | ( | std::uint32_t | correlation_id | ) |
Remove a completed/cancelled request from the map.
Should be called after get() returns to clean up.
| correlation_id | The correlation ID to remove |