C++ Actor Framework 1.0.0
|
Enables actors to delay a response message by capturing the context of a request message. More...
#include <response_promise.hpp>
Public Member Functions | |
response_promise (response_promise &&)=default | |
response_promise (const response_promise &)=default | |
response_promise & | operator= (response_promise &&)=default |
response_promise & | operator= (const response_promise &)=default |
bool | async () const noexcept |
Returns whether this response promise replies to an asynchronous message. | |
bool | pending () const noexcept |
Queries whether this promise is a valid promise that is not satisfied yet. | |
strong_actor_ptr | source () const noexcept |
Returns the source of the corresponding request. | |
message_id | id () const noexcept |
Returns the message ID of the corresponding request. | |
void | deliver (message msg) |
Satisfies the promise by sending the given message. | |
void | deliver (error x) |
Satisfies the promise by sending an error message. | |
void | deliver () |
Satisfies the promise by sending an empty message. | |
void | deliver (unit_t) |
Satisfies the promise by sending an empty message. | |
template<class... Ts> | |
void | deliver (Ts... xs) |
Satisfies the promise by sending make_message(xs...) . | |
template<class T > | |
void | deliver (expected< T > x) |
Satisfies the promise by sending the content of x , i.e., either a value of type T or an error. | |
template<message_priority P = message_priority::normal, class Handle , class... Ts> | |
delegated_response_type_t< Handle, detail::implicit_conversions_t< std::decay_t< Ts > >... > | delegate (const Handle &receiver, Ts &&... args) |
Satisfies the promise by delegating to another actor. | |
Friends | |
class | local_actor |
class | stream_manager |
template<class... > | |
class | typed_response_promise |
Enables actors to delay a response message by capturing the context of a request message.
This is particularly useful when an actor needs to communicate to other actors in order to fulfill a request for a client.
delegated_response_type_t< Handle, detail::implicit_conversions_t< std::decay_t< Ts > >... > caf::response_promise::delegate | ( | const Handle & | receiver, |
Ts &&... | args ) |
Satisfies the promise by delegating to another actor.
pending() == false
void caf::response_promise::deliver | ( | ) |
Satisfies the promise by sending an empty message.
async() == true
. pending() == false
void caf::response_promise::deliver | ( | error | x | ) |
Satisfies the promise by sending an error message.
pending() == false
void caf::response_promise::deliver | ( | expected< T > | x | ) |
void caf::response_promise::deliver | ( | message | msg | ) |
Satisfies the promise by sending the given message.
async() == true
. pending() == false
void caf::response_promise::deliver | ( | Ts... | xs | ) |
Satisfies the promise by sending make_message(xs...)
.
pending() == false
void caf::response_promise::deliver | ( | unit_t | ) |
Satisfies the promise by sending an empty message.
async() == true
. pending() == false