Implementation of message passing?
<p>What is the best way to implement message passing between 2 gen_servers. e.g. <a href="http://i.stack.imgur.com/2Www6.png" rel="nofollow">example of system</a>.</p>

<p>So per the image I have multiple session servers that will query the database for a list of players, (players records are added to the DB as they join), that best fit what that session needs e.g players location, level, win ratio etc.</p>

<p>The session will poll all players that the DB returns and take the first reply's until its reached its max players, session will then hand off players records it has accumulated to a server and the job is done. </p>

<p>What i'm asking is the best way to handle the message passing with least amount of error, what i am thinking so far is </p>

<ol>
<li>Session passes messages to all players</li>
<li>players receive messages returns ok</li>
<li>session receives players ok,adds to list of players, returns message so player can stop receiving messages and change state to in session
4 if player gets no reply from session, check other received messages and reply(session is probably full or died so continue on)</li>
</ol>

<p>Is this the best implementation for this section?</p>

<p>Would cast be the best way as i am not worried about getting a specific result for either player or session?</p>

<p>Or even if my architecture is completely off any criticism or change is welcome as I am new to Erlang and OTP?</p>

<p>Also session is probably a poor choice of name I was thinking of changing to game instance.</p>