doc/Isimud/EventObserver.html in isimud-0.7.0 vs doc/Isimud/EventObserver.html in isimud-1.3.1
- old
+ new
@@ -101,28 +101,16 @@
</p>
- <h2>Constant Summary</h2>
-
- <dl class="constants">
-
- <dt id="observed_models-classvariable" class="">@@observed_models =
-
- </dt>
- <dd><pre class="code"><span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span></pre></dd>
-
- </dl>
-
-
<h2>
Instance Method Summary
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
</h2>
@@ -130,10 +118,104 @@
<ul class="summary">
<li class="public ">
<span class="summary_signature">
+ <a href="#activate_observer-instance_method" title="#activate_observer (instance method)">- (Object) <strong>activate_observer</strong>(client = isimud_client) </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'>
+<p>Activate the queues for an observer.</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#deactivate_observer-instance_method" title="#deactivate_observer (instance method)">- (Object) <strong>deactivate_observer</strong>(client = isimud_client) </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'>
+<p>Deactivate the queues for an observer.</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#enable_listener%3F-instance_method" title="#enable_listener? (instance method)">- (Boolean) <strong>enable_listener?</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'>
+<p>Returns true if this instance is enabled for listening to events.</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#event_queue_name-instance_method" title="#event_queue_name (instance method)">- (Object) <strong>event_queue_name</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'></div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
<a href="#handle_event-instance_method" title="#handle_event (instance method)">- (Object) <strong>handle_event</strong>(event) </a>
</span>
@@ -154,11 +236,11 @@
<li class="public ">
<span class="summary_signature">
- <a href="#observe_events-instance_method" title="#observe_events (instance method)">- (Object) <strong>observe_events</strong>(client, exchange) </a>
+ <a href="#isimud_client-instance_method" title="#isimud_client (instance method)">- (Object) <strong>isimud_client</strong> </a>
</span>
@@ -168,20 +250,66 @@
+ <span class="summary_desc"><div class='inline'></div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#observe_events-instance_method" title="#observe_events (instance method)">- (Object) <strong>observe_events</strong>(client) </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
<span class="summary_desc"><div class='inline'>
<p>Create or attach to a queue on the specified exchange.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
+ <a href="#observed_exchange-instance_method" title="#observed_exchange (instance method)">- (Object) <strong>observed_exchange</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'>
+<p>Exchange used for listening to events.</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
<a href="#routing_keys-instance_method" title="#routing_keys (instance method)">- (Object) <strong>routing_keys</strong> </a>
</span>
@@ -221,12 +349,190 @@
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
- <h3 class="signature first" id="handle_event-instance_method">
+ <h3 class="signature first" id="activate_observer-instance_method">
+ - (<tt>Object</tt>) <strong>activate_observer</strong>(client = isimud_client)
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Activate the queues for an observer. This will create the observer queue
+and send an update message on the instance, which will trigger
+EventListener instances to set up consumers. This is useful for situations
+when an observer is to be made active without an update.</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+76
+77
+78
+79</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/isimud/event_observer.rb', line 76</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_activate_observer'>activate_observer</span><span class='lparen'>(</span><span class='id identifier rubyid_client'>client</span> <span class='op'>=</span> <span class='id identifier rubyid_isimud_client'>isimud_client</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_create_queue'>create_queue</span><span class='lparen'>(</span><span class='id identifier rubyid_client'>client</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_isimud_send_action_message'>isimud_send_action_message</span><span class='lparen'>(</span><span class='symbol'>:update</span><span class='rparen'>)</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="deactivate_observer-instance_method">
+
+ - (<tt>Object</tt>) <strong>deactivate_observer</strong>(client = isimud_client)
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Deactivate the queues for an observer. This will destroy the observer queue
+and send an update message on the instance, which will trigger
+EventListener instances to cancel consumers. Note that enable_listener?
+should resolve to false in order for the EventListener to cancel
+corresponding event consumers.</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+84
+85
+86
+87</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/isimud/event_observer.rb', line 84</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_deactivate_observer'>deactivate_observer</span><span class='lparen'>(</span><span class='id identifier rubyid_client'>client</span> <span class='op'>=</span> <span class='id identifier rubyid_isimud_client'>isimud_client</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_delete_queue'>delete_queue</span><span class='lparen'>(</span><span class='id identifier rubyid_client'>client</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_isimud_send_action_message'>isimud_send_action_message</span><span class='lparen'>(</span><span class='symbol'>:update</span><span class='rparen'>)</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="enable_listener?-instance_method">
+
+ - (<tt>Boolean</tt>) <strong>enable_listener?</strong>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Returns true if this instance is enabled for listening to events. Override
+in your subclass.</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>Boolean</tt>)</span>
+
+
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+44
+45
+46</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/isimud/event_observer.rb', line 44</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_enable_listener?'>enable_listener?</span>
+ <span class='kw'>true</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="event_queue_name-instance_method">
+
+ - (<tt>Object</tt>) <strong>event_queue_name</strong>
+
+
+
+
+
+</h3><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+65
+66
+67</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/isimud/event_observer.rb', line 65</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_event_queue_name'>event_queue_name</span>
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_event_queue_name'>event_queue_name</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="handle_event-instance_method">
+
- (<tt>Object</tt>) <strong>handle_event</strong>(event)
@@ -246,40 +552,70 @@
<tr>
<td>
<pre class="lines">
-21
-22
-23</pre>
+34
+35
+36</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/isimud/event_observer.rb', line 21</span>
+ <pre class="code"><span class="info file"># File 'lib/isimud/event_observer.rb', line 34</span>
<span class='kw'>def</span> <span class='id identifier rubyid_handle_event'>handle_event</span><span class='lparen'>(</span><span class='id identifier rubyid_event'>event</span><span class='rparen'>)</span>
- <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Isimud::EventObserver#handle_event not implemented for </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_event_queue_name'>event_queue_name</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Isimud::EventObserver#handle_event not implemented for </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_event_queue_name'>event_queue_name</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
+ <h3 class="signature " id="isimud_client-instance_method">
+
+ - (<tt>Object</tt>) <strong>isimud_client</strong>
+
+
+
+
+
+</h3><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+69
+70
+71</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/isimud/event_observer.rb', line 69</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_isimud_client'>isimud_client</span>
+ <span class='const'>Isimud</span><span class='period'>.</span><span class='id identifier rubyid_client'>client</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
<h3 class="signature " id="observe_events-instance_method">
- - (<tt>Object</tt>) <strong>observe_events</strong>(client, exchange)
+ - (<tt>Object</tt>) <strong>observe_events</strong>(client)
</h3><div class="docstring">
<div class="discussion">
<p>Create or attach to a queue on the specified exchange. When an event
message that matches the observer's routing keys is received, parse the
-event and call handle_event on same.</p>
+event and call handle_event on same. Returns the consumer for the observer</p>
</div>
</div>
<div class="tags">
@@ -289,32 +625,78 @@
<tr>
<td>
<pre class="lines">
-32
-33
-34
-35
-36
-37</pre>
+56
+57
+58
+59
+60
+61
+62
+63</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/isimud/event_observer.rb', line 32</span>
+ <pre class="code"><span class="info file"># File 'lib/isimud/event_observer.rb', line 56</span>
-<span class='kw'>def</span> <span class='id identifier rubyid_observe_events'>observe_events</span><span class='lparen'>(</span><span class='id identifier rubyid_client'>client</span><span class='comma'>,</span> <span class='id identifier rubyid_exchange'>exchange</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_bind'>bind</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_event_queue_name'>event_queue_name</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_exchange'>exchange</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_routing_keys'>routing_keys</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_message'>message</span><span class='op'>|</span>
+<span class='kw'>def</span> <span class='id identifier rubyid_observe_events'>observe_events</span><span class='lparen'>(</span><span class='id identifier rubyid_client'>client</span><span class='rparen'>)</span>
+ <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_enable_listener?'>enable_listener?</span>
+ <span class='id identifier rubyid_queue'>queue</span> <span class='op'>=</span> <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span><span class='lparen'>(</span><span class='const'>Isimud</span><span class='op'>::</span><span class='const'>TestClient</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_create_queue'>create_queue</span><span class='lparen'>(</span><span class='id identifier rubyid_client'>client</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_find_queue'>find_queue</span><span class='lparen'>(</span><span class='id identifier rubyid_event_queue_name'>event_queue_name</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_subscribe'>subscribe</span><span class='lparen'>(</span><span class='id identifier rubyid_queue'>queue</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_message'>message</span><span class='op'>|</span>
<span class='id identifier rubyid_event'>event</span> <span class='op'>=</span> <span class='const'>Event</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span>
<span class='id identifier rubyid_handle_event'>handle_event</span><span class='lparen'>(</span><span class='id identifier rubyid_event'>event</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
+ <h3 class="signature " id="observed_exchange-instance_method">
+
+ - (<tt>Object</tt>) <strong>observed_exchange</strong>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Exchange used for listening to events. Override in your subclass if you
+want to specify an alternative exchange.</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+49
+50
+51</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/isimud/event_observer.rb', line 49</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_observed_exchange'>observed_exchange</span>
+ <span class='kw'>nil</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
<h3 class="signature " id="routing_keys-instance_method">
- (<tt>Object</tt>) <strong>routing_keys</strong>
@@ -336,16 +718,16 @@
<tr>
<td>
<pre class="lines">
-26
-27
-28</pre>
+39
+40
+41</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/isimud/event_observer.rb', line 26</span>
+ <pre class="code"><span class="info file"># File 'lib/isimud/event_observer.rb', line 39</span>
<span class='kw'>def</span> <span class='id identifier rubyid_routing_keys'>routing_keys</span>
<span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
</td>
@@ -356,12 +738,12 @@
</div>
</div>
<div id="footer">
- Generated on Fri Apr 3 09:28:08 2015 by
+ Generated on Wed Jan 13 16:27:29 2016 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
- 0.8.7.6 (ruby-2.2.1).
+ 0.8.7.6 (ruby-2.2.3).
</div>
</body>
</html>
\ No newline at end of file