CAF  0.17.3
Public Types | Public Member Functions | List of all members
caf::mixin::requester< Base, Subtype > Class Template Reference

A requester is an actor that supports self->request(...). More...

#include <requester.hpp>

Inherits Base.

Public Types

using extended_base = requester
 

Public Member Functions

template<class... Ts>
 requester (Ts &&... xs)
 
template<message_priority P = message_priority::normal, class Rep = int, class Period = std::ratio<1>, class Handle = actor, class... Ts>
auto request (const Handle &dest, std::chrono::duration< Rep, Period > timeout, Ts &&... xs)
 Sends {xs...} as a synchronous message to dest with priority mp. More...
 
template<template< class > class MergePolicy, message_priority Prio = message_priority::normal, class Rep = int, class Period = std::ratio<1>, class Container , class... Ts>
auto fan_out_request (const Container &destinations, std::chrono::duration< Rep, Period > timeout, Ts &&... xs)
 Sends {xs...} to each actor in the range destinations as a synchronous message. More...
 

Detailed Description

template<class Base, class Subtype>
class caf::mixin::requester< Base, Subtype >

A requester is an actor that supports self->request(...).

{then|await|receive}.

Member Function Documentation

◆ fan_out_request()

template<class Base , class Subtype >
template<template< class > class MergePolicy, message_priority Prio = message_priority::normal, class Rep = int, class Period = std::ratio<1>, class Container , class... Ts>
auto caf::mixin::requester< Base, Subtype >::fan_out_request ( const Container &  destinations,
std::chrono::duration< Rep, Period >  timeout,
Ts &&...  xs 
)

Sends {xs...} to each actor in the range destinations as a synchronous message.

Response messages get combined into a single result according to the MergePolicy.

Template Parameters
MergePolicyConfigures how individual response messages get combined by the actor. The policy makes sure that the response handler gets invoked at most once. In case of one or more errors, the policy calls the error handler exactly once, with the first error occurred.
PrioSpecifies the priority of the synchronous messages.
ContainerA container type for holding actor handles. Must provide the type alias value_type as well as the member functions begin(), end(), and size().
Parameters
destinationsA container holding handles to all destination actors.
timeoutMaximum duration before dropping the request. The runtime system will send an error message to the actor in case the receiver does not respond in time.
Returns
A helper object that takes response handlers via .await(), .then(), or .receive().
Note
The returned handle is actor-specific. Only the actor that called request can use it for setting response handlers.

◆ request()

template<class Base , class Subtype >
template<message_priority P = message_priority::normal, class Rep = int, class Period = std::ratio<1>, class Handle = actor, class... Ts>
auto caf::mixin::requester< Base, Subtype >::request ( const Handle &  dest,
std::chrono::duration< Rep, Period >  timeout,
Ts &&...  xs 
)

Sends {xs...} as a synchronous message to dest with priority mp.

Returns
A handle identifying a future-like handle to the response.
Warning
The returned handle is actor specific and the response to the sent message cannot be received by another actor.

The documentation for this class was generated from the following file: