[erlang-questions] Forwarding call from one gen_server to another

Jeroen Koops <>
Tue Jun 17 19:34:56 CEST 2008


Hi all,

I was wondering what the common way is to call one gen_server, have this
call forwarded to another gen_server, and have this other server reply to
the client. One way of doing this is by having the first gen_server send a
cast to the second gen_server, including the PID of the client, and then
respond with a noreply. The second gen_server handles the cast by explicitly
responding to the client using gen_server:reply() - using the PID sent by
the original gen_server, of course. This seems to work, but it feels like a
clumsy way to do it - isn't there a better way?

At the end of the 'OTP Introduction' chapter, Armstrong's book 'Programming
Erlang' hints that this is documented in the OTP Design Principles, but I
cannot really find it there - am I overlooking something or is this covered
elsewhere?

Thanks in advance,

Jeroen Koops
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080617/ab772e9c/attachment.html>


More information about the erlang-questions mailing list