diff options
| author | Michael Klishin <michael@rabbitmq.com> | 2015-02-04 13:44:09 +0300 |
|---|---|---|
| committer | Michael Klishin <michael@rabbitmq.com> | 2015-02-04 13:44:09 +0300 |
| commit | 60e9321c5fbff9b23e4aa16eebf144f3e14438d8 (patch) | |
| tree | 5eb995f93d99a37a0a8e836e82f869b9fa6a5889 | |
| parent | 0bbd9baaac321552b14afaeb5fc36bc44f0feef2 (diff) | |
| download | rabbitmq-server-git-60e9321c5fbff9b23e4aa16eebf144f3e14438d8.tar.gz | |
Overview documentation for delegate
| -rw-r--r-- | src/delegate.erl | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/delegate.erl b/src/delegate.erl index 378759a64b..afe3bcb687 100644 --- a/src/delegate.erl +++ b/src/delegate.erl @@ -16,6 +16,22 @@ -module(delegate). +%% Delegates is an alternative way of doing remote calls. Compared to +%% the rpc module, it reduces inter-node communication. For example, +%% if a message is routed to 1,000 queues on node A and needs to be +%% propagated to nodes B and C, it would be nice to avoid doing 2,000 +%% remote calls to mirror processes. +%% +%% When a function is invoked using delegate:invoke/2, delegate:call/2 +%% or delegate:cast/2 on a group of pids, the pids are first split +%% into local and remote ones. Remote processes are then grouped by +%% node. The function is then invoked locally and on every node (using +%% gen_server2:multi/4) as many times as there are processes on that +%% node, sequentially. +%% +%% Errors returned when executing functions on remote nodes are re-raised +%% in the caller. + -behaviour(gen_server2). -export([start_link/1, invoke_no_result/2, invoke/2, |
