Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
a0a19dc1
Commit
a0a19dc1
authored
Feb 29, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix sphinx-build errors
parent
e182e7a3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
29 deletions
+3
-29
manual/Introduction.rst
manual/Introduction.rst
+1
-1
manual/MessagePassing.rst
manual/MessagePassing.rst
+2
-28
No files found.
manual/Introduction.rst
View file @
a0a19dc1
...
...
@@ -45,7 +45,7 @@ Dynamically Typed Actor
~~~~~~~~~~~~~~~~~~~~~~~
A dynamically typed actor accepts any kind of message and dispatches on its
content dynamically at the receiver. This is the
``traditional''
messaging
content dynamically at the receiver. This is the
"traditional"
messaging
style found in implementations like Erlang or Akka. The upside of this approach
is (usually) faster prototyping and less code. This comes at the cost of
requiring excessive testing.
...
...
manual/MessagePassing.rst
View file @
a0a19dc1
...
...
@@ -130,8 +130,8 @@ usually cause the receiving actor to terminate, unless a custom handler was
installed via ``set_error_handler(f)``, where ``f`` is a function object with
signature ``void (error&)`` or ``void (scheduled_actor*, error&)``.
Additionally, ``request`` accepts an error handler as second argument to handle
errors for a particular request
(see :ref:`error-response`). The default handler
is used as fallback if
``request`` is used without error handler.
errors for a particular request
. The default handler is used as fallback if
``request`` is used without error handler.
.. _default-handler:
...
...
@@ -245,32 +245,6 @@ Both event-based approaches send all requests, install a series of one-shot
handlers, and then return from the implementing function. In contrast, the
blocking function waits for a response before sending another request.
Sending Multiple Requests
~~~~~~~~~~~~~~~~~~~~~~~~~
Sending the same message to a group of workers is a common work flow in actor
applications. Usually, a manager maintains a set of workers. On request, the
manager fans-out the request to all of its workers and then collects the
results. The function ``fan_out_request`` combined with the merge policy
``select_all`` streamlines this exact use case.
In the following snippet, we have a matrix actor (``self``) that stores
worker actors for each cell (each simply storing an integer). For computing the
average over a row, we use ``fan_out_request``. The result handler
passed to ``then`` now gets called only once with a ``vector``
holding all collected results. Using a response promise promise_ further
allows us to delay responding to the client until we have collected all worker
results.
.. literalinclude:: /examples/message_passing/fan_out_request.cpp
:language: C++
:lines: 86-98
The policy ``select_any`` models a second common use case: sending a
request to multiple receivers but only caring for the first arriving response.
.. _error-response:
Error Handling in Requests
~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment