aboutsummaryrefslogtreecommitdiffstats
path: root/router.html
diff options
context:
space:
mode:
Diffstat (limited to 'router.html')
-rw-r--r--router.html63
1 files changed, 51 insertions, 12 deletions
diff --git a/router.html b/router.html
index 8c8c96b..a98b4c3 100644
--- a/router.html
+++ b/router.html
@@ -147,11 +147,38 @@
147<dt id="eventmq.router.Router"> 147<dt id="eventmq.router.Router">
148<em class="property">class </em><code class="descclassname">eventmq.router.</code><code class="descname">Router</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router" title="Permalink to this definition">¶</a></dt> 148<em class="property">class </em><code class="descclassname">eventmq.router.</code><code class="descname">Router</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router" title="Permalink to this definition">¶</a></dt>
149<dd><p>A simple router of messages</p> 149<dd><p>A simple router of messages</p>
150<p>This router uses tornado&#8217;s eventloop.</p> 150<dl class="method">
151<dt id="eventmq.router.Router.add_worker">
152<code class="descname">add_worker</code><span class="sig-paren">(</span><em>id</em>, <em>queues=None</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.add_worker" title="Permalink to this definition">¶</a></dt>
153<dd><p>Adds a worker to worker queues</p>
154<table class="docutils field-list" frame="void" rules="none">
155<col class="field-name" />
156<col class="field-body" />
157<tbody valign="top">
158<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
159<li><strong>worker_id</strong> &#8211; unique id of the worker to add</li>
160<li><strong>queues</strong> &#8211; queue or queues this worker should be a member of</li>
161</ul>
162</td>
163</tr>
164</tbody>
165</table>
166</dd></dl>
167
168<dl class="method">
169<dt id="eventmq.router.Router.clean_up_dead_workers">
170<code class="descname">clean_up_dead_workers</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.clean_up_dead_workers" title="Permalink to this definition">¶</a></dt>
171<dd><p>Loops through the worker queues and removes any workers who haven&#8217;t
172responded in HEARTBEAT_TIMEOUT</p>
173</dd></dl>
174
151<dl class="method"> 175<dl class="method">
152<dt id="eventmq.router.Router.on_heartbeat"> 176<dt id="eventmq.router.Router.on_heartbeat">
153<code class="descname">on_heartbeat</code><span class="sig-paren">(</span><em>sender</em>, <em>msgid</em>, <em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.on_heartbeat" title="Permalink to this definition">¶</a></dt> 177<code class="descname">on_heartbeat</code><span class="sig-paren">(</span><em>sender</em>, <em>msgid</em>, <em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.on_heartbeat" title="Permalink to this definition">¶</a></dt>
154<dd></dd></dl> 178<dd><p>a placeholder for a noop command. The actual &#8216;logic&#8217; for HEARTBEAT is
179in <code class="xref py py-meth docutils literal"><span class="pre">self.process_worker_message()</span></code> because any message from a worker
180counts as a HEARTBEAT</p>
181</dd></dl>
155 182
156<dl class="method"> 183<dl class="method">
157<dt id="eventmq.router.Router.on_inform"> 184<dt id="eventmq.router.Router.on_inform">
@@ -160,8 +187,16 @@
160</dd></dl> 187</dd></dl>
161 188
162<dl class="method"> 189<dl class="method">
163<dt id="eventmq.router.Router.on_receive_reply"> 190<dt id="eventmq.router.Router.on_receive_request">
164<code class="descname">on_receive_reply</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.on_receive_reply" title="Permalink to this definition">¶</a></dt> 191<code class="descname">on_receive_request</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.on_receive_request" title="Permalink to this definition">¶</a></dt>
192<dd><p>This function is called when a message comes in from the client socket.
193It then calls <cite>on_command</cite>. If <cite>on_command</cite> isn&#8217;t found, then a
194warning is created.</p>
195</dd></dl>
196
197<dl class="method">
198<dt id="eventmq.router.Router.process_worker_message">
199<code class="descname">process_worker_message</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.process_worker_message" title="Permalink to this definition">¶</a></dt>
165<dd><p>This method is called when a message comes in from the worker socket. 200<dd><p>This method is called when a message comes in from the worker socket.
166It then calls <cite>on_command</cite>. If <cite>on_command</cite> isn&#8217;t found, then a warning 201It then calls <cite>on_command</cite>. If <cite>on_command</cite> isn&#8217;t found, then a warning
167is created.</p> 202is created.</p>
@@ -172,14 +207,6 @@ is created.</p>
172</dd></dl> 207</dd></dl>
173 208
174<dl class="method"> 209<dl class="method">
175<dt id="eventmq.router.Router.on_receive_request">
176<code class="descname">on_receive_request</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.on_receive_request" title="Permalink to this definition">¶</a></dt>
177<dd><p>This function is called when a message comes in from the client socket.
178It then calls <cite>on_command</cite>. If <cite>on_command</cite> isn&#8217;t found, then a
179warning is created.</p>
180</dd></dl>
181
182<dl class="method">
183<dt id="eventmq.router.Router.send_ack"> 210<dt id="eventmq.router.Router.send_ack">
184<code class="descname">send_ack</code><span class="sig-paren">(</span><em>socket</em>, <em>recipient</em>, <em>msgid</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.send_ack" title="Permalink to this definition">¶</a></dt> 211<code class="descname">send_ack</code><span class="sig-paren">(</span><em>socket</em>, <em>recipient</em>, <em>msgid</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.send_ack" title="Permalink to this definition">¶</a></dt>
185<dd><p>Sends an ACK response</p> 212<dd><p>Sends an ACK response</p>
@@ -190,6 +217,18 @@ warning is created.</p>
190<code class="descname">send_heartbeat</code><span class="sig-paren">(</span><em>socket</em>, <em>recipient</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.send_heartbeat" title="Permalink to this definition">¶</a></dt> 217<code class="descname">send_heartbeat</code><span class="sig-paren">(</span><em>socket</em>, <em>recipient</em><span class="sig-paren">)</span><a class="headerlink" href="#eventmq.router.Router.send_heartbeat" title="Permalink to this definition">¶</a></dt>
191<dd><p>Custom send heartbeat method to take into account the recipient that is 218<dd><p>Custom send heartbeat method to take into account the recipient that is
192needed when building messages</p> 219needed when building messages</p>
220<table class="docutils field-list" frame="void" rules="none">
221<col class="field-name" />
222<col class="field-body" />
223<tbody valign="top">
224<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
225<li><strong>socket</strong> (<a class="reference external" href="https://docs.python.org/library/socket.html#module-socket" title="(in Python v2.7)"><em>socket</em></a>) &#8211; the socket to send the heartbeat with</li>
226<li><strong>recipient</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; Worker I</li>
227</ul>
228</td>
229</tr>
230</tbody>
231</table>
193</dd></dl> 232</dd></dl>
194 233
195<dl class="method"> 234<dl class="method">