doc/Isimud/BunnyClient.html in isimud-0.7.0 vs doc/Isimud/BunnyClient.html in isimud-1.3.1
- old
+ new
@@ -99,11 +99,29 @@
<dd class="r2 last">lib/isimud/bunny_client.rb</dd>
</dl>
<div class="clear"></div>
+<h2>Overview</h2><div class="docstring">
+ <div class="discussion">
+
+<p>Interface for Bunny RabbitMQ client</p>
+
+ </div>
+</div>
+<div class="tags">
+
+
+ <p class="tag_title">See Also:</p>
+ <ul class="see">
+
+ <li><a href="http://rubybunny.info" target="_parent" title="http://rubybunny.info">http://rubybunny.info</a></li>
+
+ </ul>
+
+</div>
<h2>Constant Summary</h2>
<dl class="constants">
<dt id="DEFAULT_URL-constant" class="">DEFAULT_URL =
@@ -168,11 +186,11 @@
<ul class="summary">
<li class="public ">
<span class="summary_signature">
- <a href="#bind-instance_method" title="#bind (instance method)">- (Object) <strong>bind</strong>(queue_name, exchange_name, *routing_keys, &block) </a>
+ <a href="#bind-instance_method" title="#bind (instance method)">- (Bunny::Consumer) <strong>bind</strong>(queue_name, exchange_name, *routing_keys) {|payload| ... }</a>
</span>
@@ -182,19 +200,22 @@
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'>
+<p>Convenience method that finds or creates a named queue, binds to an
+exchange, and subscribes to messages.</p>
+</div></span>
</li>
<li class="public ">
<span class="summary_signature">
- <a href="#channel-instance_method" title="#channel (instance method)">- (Object) <strong>channel</strong> </a>
+ <a href="#channel-instance_method" title="#channel (instance method)">- (Bunny::Channel) <strong>channel</strong> </a>
</span>
@@ -204,11 +225,14 @@
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'>
+<p>Open a new, thread-specific AMQP connection channel, or return the current
+channel for this thread if it exists and is currently open.</p>
+</div></span>
</li>
<li class="public ">
@@ -226,19 +250,21 @@
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'>
+<p>Close the AMQP connection and clear it from the instance.</p>
+</div></span>
</li>
<li class="public ">
<span class="summary_signature">
- <a href="#connected%3F-instance_method" title="#connected? (instance method)">- (Boolean) <strong>connected?</strong> </a>
+ <a href="#connected%3F-instance_method" title="#connected? (instance method)">- (Boolean<sup>?</sup>) <strong>connected?</strong> </a>
</span>
@@ -248,19 +274,22 @@
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'>
+<p>Determine if a Bunny connection is currently established to the AMQP
+server.</p>
+</div></span>
</li>
<li class="public ">
<span class="summary_signature">
- <a href="#connection-instance_method" title="#connection (instance method)">- (Object) <strong>connection</strong> </a>
+ <a href="#connection-instance_method" title="#connection (instance method)">- (Bunny::Session) <strong>connection</strong> </a>
(also: #connect)
@@ -272,19 +301,22 @@
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'>
+<p>Establish a connection to the AMQP server, or return the current connection
+if one already exists.</p>
+</div></span>
</li>
<li class="public ">
<span class="summary_signature">
- <a href="#create_queue-instance_method" title="#create_queue (instance method)">- (Object) <strong>create_queue</strong>(queue_name, exchange_name, options = {}, &block) </a>
+ <a href="#create_queue-instance_method" title="#create_queue (instance method)">- (Bunny::Queue) <strong>create_queue</strong>(queue_name, exchange_name, options = {}) </a>
</span>
@@ -294,19 +326,21 @@
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'>
+<p>Find or create a named queue and bind it to the specified exchange.</p>
+</div></span>
</li>
<li class="public ">
<span class="summary_signature">
- <a href="#delete_queue-instance_method" title="#delete_queue (instance method)">- (Object) <strong>delete_queue</strong>(queue_name) </a>
+ <a href="#delete_queue-instance_method" title="#delete_queue (instance method)">- (AMQ::Protocol::Queue::DeleteOk) <strong>delete_queue</strong>(queue_name) </a>
</span>
@@ -316,19 +350,21 @@
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'>
+<p>Permanently delete the queue from the AMQP server.</p>
+</div></span>
</li>
<li class="public ">
<span class="summary_signature">
- <a href="#exception_handler-instance_method" title="#exception_handler (instance method)">- (Object) <strong>exception_handler</strong>(&block) </a>
+ <a href="#find_queue-instance_method" title="#find_queue (instance method)">- (Object) <strong>find_queue</strong>(queue_name, options = {durable: true}) </a>
</span>
@@ -338,11 +374,13 @@
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'>
+<p>Look up a queue by name, or create it if it does not already exist.</p>
+</div></span>
</li>
<li class="public ">
@@ -363,11 +401,11 @@
<span class="summary_desc"><div class='inline'>
-<p>A new instance of BunnyClient.</p>
+<p>Initialize a new BunnyClient instance.</p>
</div></span>
</li>
@@ -386,19 +424,22 @@
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'>
+<p>Publish a message to the specified exchange, which is declared as a
+durable, topic exchange.</p>
+</div></span>
</li>
<li class="public ">
<span class="summary_signature">
- <a href="#reconnect-instance_method" title="#reconnect (instance method)">- (Object) <strong>reconnect</strong> </a>
+ <a href="#reconnect-instance_method" title="#reconnect (instance method)">- (Bunny::Session) <strong>reconnect</strong> </a>
</span>
@@ -408,11 +449,13 @@
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'>
+<p>Close and reopen the AMQP connection.</p>
+</div></span>
</li>
<li class="public ">
@@ -430,15 +473,41 @@
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'>
+<p>Reset this client by closing all channels for the connection.</p>
+</div></span>
</li>
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#subscribe-instance_method" title="#subscribe (instance method)">- (Object) <strong>subscribe</strong>(queue, options = {manual_ack: true}) {|payload| ... }</a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'>
+<p>Subscribe to messages on the Bunny queue.</p>
+</div></span>
+
+</li>
+
+
</ul>
@@ -447,16 +516,21 @@
+ <h3 class="inherited">Methods inherited from <span class='object_link'><a href="Client.html" title="Isimud::Client (class)">Client</a></span></h3>
+ <p class="inherited"><span class='object_link'><a href="Client.html#on_exception-instance_method" title="Isimud::Client#on_exception (method)">#on_exception</a></span>, <span class='object_link'><a href="Client.html#run_exception_handlers-instance_method" title="Isimud::Client#run_exception_handlers (method)">#run_exception_handlers</a></span></p>
+
+
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Logging.html" title="Isimud::Logging (module)">Logging</a></span></h3>
<p class="inherited"><span class='object_link'><a href="Logging.html#log-instance_method" title="Isimud::Logging#log (method)">#log</a></span>, <span class='object_link'><a href="Logging.html#logger-instance_method" title="Isimud::Logging#logger (method)">#logger</a></span></p>
<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
@@ -470,32 +544,80 @@
</h3><div class="docstring">
<div class="discussion">
-<p>Returns a new instance of BunnyClient</p>
+<p>Initialize a new BunnyClient instance. Note that a connection is not
+established until any other method is called</p>
</div>
</div>
<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+ <li>
+
+ <span class='name'>_url</span>
+
+
+ <span class='type'>(<tt>String</tt>, <tt>Hash</tt>)</span>
+
+
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
+
+
+ —
+ <div class='inline'>
+<p>Server URL or options hash</p>
+</div>
+
+ </li>
+
+ <li>
+
+ <span class='name'>_bunny_options</span>
+
+
+ <span class='type'>(<tt>Hash</tt>)</span>
+
+
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
+
+
+ —
+ <div class='inline'>
+<p>optional Bunny connection options</p>
+</div>
+
+ </li>
+
+</ul>
+
+ <p class="tag_title">See Also:</p>
+ <ul class="see">
+
+ <li>for connection options</li>
+
+ </ul>
+
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-10
-11
-12
-13
-14</pre>
+18
+19
+20
+21
+22</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 10</span>
+ <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 18</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid__url'>_url</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid__bunny_options'>_bunny_options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
<span class='id identifier rubyid_log'>log</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Isimud::BunnyClient.initialize: options = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid__bunny_options'>_bunny_options</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
<span class='ivar'>@url</span> <span class='op'>=</span> <span class='id identifier rubyid__url'>_url</span> <span class='op'>||</span> <span class='const'>DEFAULT_URL</span>
<span class='ivar'>@bunny_options</span> <span class='op'>=</span> <span class='id identifier rubyid__bunny_options'>_bunny_options</span>
@@ -536,16 +658,16 @@
<tr>
<td>
<pre class="lines">
-8
-9
-10</pre>
+11
+12
+13</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 8</span>
+ <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 11</span>
<span class='kw'>def</span> <span class='id identifier rubyid_url'>url</span>
<span class='ivar'>@url</span>
<span class='kw'>end</span></pre>
</td>
@@ -561,71 +683,208 @@
<div class="method_details first">
<h3 class="signature first" id="bind-instance_method">
- - (<tt>Object</tt>) <strong>bind</strong>(queue_name, exchange_name, *routing_keys, &block)
+ - (<tt>Bunny::Consumer</tt>) <strong>bind</strong>(queue_name, exchange_name, *routing_keys) {|payload| ... }
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Convenience method that finds or creates a named queue, binds to an
+exchange, and subscribes to messages. If a block is provided, it will be
+called by the consumer each time a message is received.</p>
+
+
+ </div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+
+ <li>
+
+ <span class='name'>queue_name</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'>
+<p>name of the queue</p>
+</div>
+
+ </li>
+
+ <li>
+
+ <span class='name'>exchange_name</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'>
+<p>name of the AMQP exchange. Note that existing exchanges must be declared as
+Topic exchanges; otherwise, an error will occur</p>
+</div>
+
+ </li>
+
+ <li>
+
+ <span class='name'>routing_keys</span>
+
+
+ <span class='type'>(<tt>Array<String></tt>)</span>
+
+
+
+ —
+ <div class='inline'>
+<p>list of routing keys to be bound to the queue for the specified exchange.</p>
+</div>
+
+ </li>
+
+</ul>
+
+<p class="tag_title">Yield Parameters:</p>
+<ul class="yieldparam">
+
+ <li>
+
+ <span class='name'>payload</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'>
+<p>message text</p>
+</div>
+
+ </li>
+
+</ul>
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>Bunny::Consumer</tt>)</span>
+
+
+
+ —
+ <div class='inline'>
+<p>Bunny consumer interface</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-16
-17
-18
-19
-20
-21</pre>
+33
+34
+35
+36
+37
+38</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 16</span>
+ <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 33</span>
<span class='kw'>def</span> <span class='id identifier rubyid_bind'>bind</span><span class='lparen'>(</span><span class='id identifier rubyid_queue_name'>queue_name</span><span class='comma'>,</span> <span class='id identifier rubyid_exchange_name'>exchange_name</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_routing_keys'>routing_keys</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_create_queue'>create_queue</span><span class='lparen'>(</span><span class='id identifier rubyid_queue_name'>queue_name</span><span class='comma'>,</span> <span class='id identifier rubyid_exchange_name'>exchange_name</span><span class='comma'>,</span>
- <span class='label'>queue_options:</span> <span class='lbrace'>{</span><span class='label'>durable:</span> <span class='kw'>true</span><span class='rbrace'>}</span><span class='comma'>,</span>
- <span class='label'>routing_keys:</span> <span class='id identifier rubyid_routing_keys'>routing_keys</span><span class='comma'>,</span>
- <span class='label'>subscribe_options:</span> <span class='lbrace'>{</span><span class='label'>manual_ack:</span> <span class='kw'>true</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_queue'>queue</span> <span class='op'>=</span> <span class='id identifier rubyid_create_queue'>create_queue</span><span class='lparen'>(</span><span class='id identifier rubyid_queue_name'>queue_name</span><span class='comma'>,</span> <span class='id identifier rubyid_exchange_name'>exchange_name</span><span class='comma'>,</span>
+ <span class='label'>queue_options:</span> <span class='lbrace'>{</span><span class='label'>durable:</span> <span class='kw'>true</span><span class='rbrace'>}</span><span class='comma'>,</span>
+ <span class='label'>routing_keys:</span> <span class='id identifier rubyid_routing_keys'>routing_keys</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_subscribe'>subscribe</span><span class='lparen'>(</span><span class='id identifier rubyid_queue'>queue</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="channel-instance_method">
- - (<tt>Object</tt>) <strong>channel</strong>
+ - (<tt>Bunny::Channel</tt>) <strong>channel</strong>
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Open a new, thread-specific AMQP connection channel, or return the current
+channel for this thread if it exists</p>
+
+<pre class="code ruby"><code class="ruby">and is currently open. New channels are created with publisher confirms enabled. Messages will be prefetched
+according to Isimud.prefetch_count when declared.</code></pre>
+
+
+ </div>
+</div>
+<div class="tags">
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>Bunny::Channel</tt>)</span>
+
+
+
+ —
+ <div class='inline'>
+<p>channel instance.</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70</pre>
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 61</span>
+ <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 107</span>
<span class='kw'>def</span> <span class='id identifier rubyid_channel'>channel</span>
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_channel'>channel</span> <span class='op'>=</span> <span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='const'>CHANNEL_KEY</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_try'>try</span><span class='lparen'>(</span><span class='symbol'>:open?</span><span class='rparen'>)</span>
<span class='id identifier rubyid_channel'>channel</span>
<span class='kw'>else</span>
@@ -647,24 +906,53 @@
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Close the AMQP connection and clear it from the instance.</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'></span>
+
+
+
+
+ <div class='inline'>
+<p>nil</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-86
-87
-88
-89
-90</pre>
+132
+133
+134
+135
+136</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 86</span>
+ <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 132</span>
<span class='kw'>def</span> <span class='id identifier rubyid_close'>close</span>
<span class='id identifier rubyid_connection'>connection</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
<span class='kw'>ensure</span>
<span class='ivar'>@connection</span> <span class='op'>=</span> <span class='kw'>nil</span>
@@ -675,50 +963,60 @@
</div>
<div class="method_details ">
<h3 class="signature " id="connected?-instance_method">
- - (<tt>Boolean</tt>) <strong>connected?</strong>
+ - (<tt>Boolean</tt><sup>?</sup>) <strong>connected?</strong>
</h3><div class="docstring">
<div class="discussion">
+<p>Determine if a Bunny connection is currently established to the AMQP
+server. but is closed or closing, or nil if no connection has been
+established.</p>
+
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
- <span class='type'>(<tt>Boolean</tt>)</span>
+ <span class='type'>(<tt>Boolean</tt>, <tt>nil</tt>)</span>
+ —
+ <div class='inline'>
+<p>true if a connection was established and is active or starting, false if a
+connection exists</p>
+</div>
+
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-82
-83
-84</pre>
+126
+127
+128</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 82</span>
+ <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 126</span>
<span class='kw'>def</span> <span class='id identifier rubyid_connected?'>connected?</span>
<span class='ivar'>@connection</span> <span class='op'>&&</span> <span class='ivar'>@connection</span><span class='period'>.</span><span class='id identifier rubyid_open?'>open?</span>
<span class='kw'>end</span></pre>
</td>
@@ -727,32 +1025,57 @@
</div>
<div class="method_details ">
<h3 class="signature " id="connection-instance_method">
- - (<tt>Object</tt>) <strong>connection</strong>
+ - (<tt>Bunny::Session</tt>) <strong>connection</strong>
<span class="aliases">Also known as:
<span class="names"><span id='connect-instance_method'>connect</span></span>
</span>
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Establish a connection to the AMQP server, or return the current connection
+if one already exists</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>Bunny::Session</tt>)</span>
+
+
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-53
-54
-55</pre>
+95
+96
+97</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 53</span>
+ <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 95</span>
<span class='kw'>def</span> <span class='id identifier rubyid_connection'>connection</span>
<span class='ivar'>@connection</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Bunny</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='ivar'>@bunny_options</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_tap'>tap</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:start</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
@@ -761,139 +1084,292 @@
</div>
<div class="method_details ">
<h3 class="signature " id="create_queue-instance_method">
- - (<tt>Object</tt>) <strong>create_queue</strong>(queue_name, exchange_name, options = {}, &block)
+ - (<tt>Bunny::Queue</tt>) <strong>create_queue</strong>(queue_name, exchange_name, options = {})
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Find or create a named queue and bind it to the specified exchange</p>
+
+
+ </div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+
+ <li>
+
+ <span class='name'>queue_name</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'>
+<p>name of the queue</p>
+</div>
+
+ </li>
+
+ <li>
+
+ <span class='name'>exchange_name</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'>
+<p>name of the AMQP exchange. Note that pre-existing exchanges must be
+declared as Topic exchanges; otherwise, an error will occur</p>
+</div>
+
+ </li>
+
+ <li>
+
+ <span class='name'>options</span>
+
+
+ <span class='type'>(<tt>Hash</tt>)</span>
+
+
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
+
+
+ —
+ <div class='inline'>
+<p>queue declaration options</p>
+</div>
+
+ </li>
+
+</ul>
+
+
+
+
+
+
+
+
+ <p class="tag_title">Options Hash (<tt>options</tt>):</p>
+ <ul class="option">
+
+ <li>
+ <span class="name">:queue_options</span>
+ <span class="type">(<tt>Boolean</tt>)</span>
+ <span class="default">
+
+ — default:
+ <tt>{durable: true}</tt>
+
+ </span>
+
+ — <div class='inline'>
+<p>queue declaration options – @see Bunny::Channel#queue</p>
+</div>
+
+ </li>
+
+ <li>
+ <span class="name">:routing_keys</span>
+ <span class="type">(<tt>Array<String></tt>)</span>
+ <span class="default">
+
+ — default:
+ <tt>[]</tt>
+
+ </span>
+
+ — <div class='inline'>
+<p>routing keys to be bound to the queue. Use “*” to match any 1 word in a
+route segment. Use “#” to match 0 or more words in a segment.</p>
+</div>
+
+ </li>
+
+ </ul>
+
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>Bunny::Queue</tt>)</span>
+
+
+
+ —
+ <div class='inline'>
+<p>Bunny queue</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47</pre>
+50
+51
+52
+53
+54
+55
+56
+57</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 23</span>
+ <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 50</span>
-<span class='kw'>def</span> <span class='id identifier rubyid_create_queue'>create_queue</span><span class='lparen'>(</span><span class='id identifier rubyid_queue_name'>queue_name</span><span class='comma'>,</span> <span class='id identifier rubyid_exchange_name'>exchange_name</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_queue_options'>queue_options</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:queue_options</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
- <span class='id identifier rubyid_routing_keys'>routing_keys</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:routing_keys</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
- <span class='id identifier rubyid_subscribe_options'>subscribe_options</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:subscribe_options</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
- <span class='id identifier rubyid_log'>log</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Isimud: create_queue </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_queue_name'>queue_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>: queue_options=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_queue_options'>queue_options</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> routing_keys=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_routing_keys'>routing_keys</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>,</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'> subscribe_options=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_subscribe_options'>subscribe_options</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
- <span class='id identifier rubyid_current_channel'>current_channel</span> <span class='op'>=</span> <span class='id identifier rubyid_channel'>channel</span>
- <span class='id identifier rubyid_queue'>queue</span> <span class='op'>=</span> <span class='id identifier rubyid_current_channel'>current_channel</span><span class='period'>.</span><span class='id identifier rubyid_queue'>queue</span><span class='lparen'>(</span><span class='id identifier rubyid_queue_name'>queue_name</span><span class='comma'>,</span> <span class='id identifier rubyid_queue_options'>queue_options</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_routing_keys'>routing_keys</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span> <span class='id identifier rubyid_queue'>queue</span><span class='period'>.</span><span class='id identifier rubyid_bind'>bind</span><span class='lparen'>(</span><span class='id identifier rubyid_exchange_name'>exchange_name</span><span class='comma'>,</span> <span class='label'>routing_key:</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='label'>nowait:</span> <span class='kw'>false</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
- <span class='id identifier rubyid_queue'>queue</span><span class='period'>.</span><span class='id identifier rubyid_subscribe'>subscribe</span><span class='lparen'>(</span><span class='id identifier rubyid_subscribe_options'>subscribe_options</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_delivery_info'>delivery_info</span><span class='comma'>,</span> <span class='id identifier rubyid_properties'>properties</span><span class='comma'>,</span> <span class='id identifier rubyid_payload'>payload</span><span class='op'>|</span>
- <span class='kw'>begin</span>
- <span class='id identifier rubyid_log'>log</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Isimud: queue </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_queue_name'>queue_name</span><span class='embexpr_end'>}</span><span class='tstring_content'> received </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_delivery_info'>delivery_info</span><span class='period'>.</span><span class='id identifier rubyid_delivery_tag'>delivery_tag</span><span class='embexpr_end'>}</span><span class='tstring_content'> routing_key: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_delivery_info'>delivery_info</span><span class='period'>.</span><span class='id identifier rubyid_routing_key'>routing_key</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
- <span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>isimud_queue_name</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_queue_name'>queue_name</span>
- <span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>isimud_delivery_info</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_delivery_info'>delivery_info</span>
- <span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>isimud_properties</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_properties'>properties</span>
- <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_payload'>payload</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_log'>log</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Isimud: queue </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_queue_name'>queue_name</span><span class='embexpr_end'>}</span><span class='tstring_content'> finished with </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_delivery_info'>delivery_info</span><span class='period'>.</span><span class='id identifier rubyid_delivery_tag'>delivery_tag</span><span class='embexpr_end'>}</span><span class='tstring_content'>, acknowledging</span><span class='tstring_end'>"</span></span>
- <span class='id identifier rubyid_current_channel'>current_channel</span><span class='period'>.</span><span class='id identifier rubyid_ack'>ack</span><span class='lparen'>(</span><span class='id identifier rubyid_delivery_info'>delivery_info</span><span class='period'>.</span><span class='id identifier rubyid_delivery_tag'>delivery_tag</span><span class='rparen'>)</span>
- <span class='kw'>rescue</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
- <span class='id identifier rubyid_log'>log</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Isimud: queue </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_queue_name'>queue_name</span><span class='embexpr_end'>}</span><span class='tstring_content'> error processing </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_delivery_info'>delivery_info</span><span class='period'>.</span><span class='id identifier rubyid_delivery_tag'>delivery_tag</span><span class='embexpr_end'>}</span><span class='tstring_content'> payload </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_payload'>payload</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_backtrace'>backtrace</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n </span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:warn</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_current_channel'>current_channel</span><span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span><span class='lparen'>(</span><span class='id identifier rubyid_delivery_info'>delivery_info</span><span class='period'>.</span><span class='id identifier rubyid_delivery_tag'>delivery_tag</span><span class='comma'>,</span> <span class='const'>Isimud</span><span class='period'>.</span><span class='id identifier rubyid_retry_failures'>retry_failures</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_raise'>raise</span>
- <span class='kw'>end</span>
- <span class='kw'>end</span>
+<span class='kw'>def</span> <span class='id identifier rubyid_create_queue'>create_queue</span><span class='lparen'>(</span><span class='id identifier rubyid_queue_name'>queue_name</span><span class='comma'>,</span> <span class='id identifier rubyid_exchange_name'>exchange_name</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_queue_options'>queue_options</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:queue_options</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='label'>durable:</span> <span class='kw'>true</span><span class='rbrace'>}</span>
+ <span class='id identifier rubyid_routing_keys'>routing_keys</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:routing_keys</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
+ <span class='id identifier rubyid_log'>log</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Isimud::BunnyClient: create_queue </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_queue_name'>queue_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>: queue_options=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_queue_options'>queue_options</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
+ <span class='id identifier rubyid_queue'>queue</span> <span class='op'>=</span> <span class='id identifier rubyid_find_queue'>find_queue</span><span class='lparen'>(</span><span class='id identifier rubyid_queue_name'>queue_name</span><span class='comma'>,</span> <span class='id identifier rubyid_queue_options'>queue_options</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_bind_routing_keys'>bind_routing_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_queue'>queue</span><span class='comma'>,</span> <span class='id identifier rubyid_exchange_name'>exchange_name</span><span class='comma'>,</span> <span class='id identifier rubyid_routing_keys'>routing_keys</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_routing_keys'>routing_keys</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span>
<span class='id identifier rubyid_queue'>queue</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="delete_queue-instance_method">
- - (<tt>Object</tt>) <strong>delete_queue</strong>(queue_name)
+ - (<tt>AMQ::Protocol::Queue::DeleteOk</tt>) <strong>delete_queue</strong>(queue_name)
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Permanently delete the queue from the AMQP server. Any messages present in
+the queue will be discarded.</p>
+
+
+ </div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+
+ <li>
+
+ <span class='name'>queue_name</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'>
+<p>queue name</p>
+</div>
+
+ </li>
+
+</ul>
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>AMQ::Protocol::Queue::DeleteOk</tt>)</span>
+
+
+
+ —
+ <div class='inline'>
+<p>RabbitMQ response</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-49
-50
-51</pre>
+89
+90
+91</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 49</span>
+ <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 89</span>
<span class='kw'>def</span> <span class='id identifier rubyid_delete_queue'>delete_queue</span><span class='lparen'>(</span><span class='id identifier rubyid_queue_name'>queue_name</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_channel'>channel</span><span class='period'>.</span><span class='id identifier rubyid_queue'>queue</span><span class='lparen'>(</span><span class='id identifier rubyid_queue_name'>queue_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span>
+ <span class='id identifier rubyid_channel'>channel</span><span class='period'>.</span><span class='id identifier rubyid_queue_delete'>queue_delete</span><span class='lparen'>(</span><span class='id identifier rubyid_queue_name'>queue_name</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
- <h3 class="signature " id="exception_handler-instance_method">
+ <h3 class="signature " id="find_queue-instance_method">
- - (<tt>Object</tt>) <strong>exception_handler</strong>(&block)
+ - (<tt>Object</tt>) <strong>find_queue</strong>(queue_name, options = {durable: true})
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Look up a queue by name, or create it if it does not already exist.</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-76
-77
-78
-79
-80</pre>
+156
+157
+158</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 76</span>
+ <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 156</span>
-<span class='kw'>def</span> <span class='id identifier rubyid_exception_handler'>exception_handler</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_channel'>channel</span><span class='period'>.</span><span class='id identifier rubyid_on_uncaught_exception'>on_uncaught_exception</span> <span class='kw'>do</span>
- <span class='kw'>yield</span>
- <span class='kw'>end</span>
+<span class='kw'>def</span> <span class='id identifier rubyid_find_queue'>find_queue</span><span class='lparen'>(</span><span class='id identifier rubyid_queue_name'>queue_name</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>durable:</span> <span class='kw'>true</span><span class='rbrace'>}</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_channel'>channel</span><span class='period'>.</span><span class='id identifier rubyid_queue'>queue</span><span class='lparen'>(</span><span class='id identifier rubyid_queue_name'>queue_name</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
@@ -905,22 +1381,80 @@
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Publish a message to the specified exchange, which is declared as a
+durable, topic exchange. Note that message</p>
+
+<pre class="code ruby"><code class="ruby">is always persisted.</code></pre>
+
+
+ </div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+
+ <li>
+
+ <span class='name'>exchange</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'>
+<p>AMQP exchange name</p>
+</div>
+
+ </li>
+
+ <li>
+
+ <span class='name'>routing_key</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'>
+<p>message routing key. This should always be in the form of words separated
+by dots e.g. “user.goal.complete”</p>
+</div>
+
+ </li>
+
+</ul>
+
+
+ <p class="tag_title">See Also:</p>
+ <ul class="see">
+
+ <li><a href="http://rubybunny.info/articles/exchanges.html" target="_parent" title="http://rubybunny.info/articles/exchanges.html">http://rubybunny.info/articles/exchanges.html</a></li>
+
+ </ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-92
-93
-94</pre>
+144
+145
+146</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 92</span>
+ <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 144</span>
<span class='kw'>def</span> <span class='id identifier rubyid_publish'>publish</span><span class='lparen'>(</span><span class='id identifier rubyid_exchange'>exchange</span><span class='comma'>,</span> <span class='id identifier rubyid_routing_key'>routing_key</span><span class='comma'>,</span> <span class='id identifier rubyid_payload'>payload</span><span class='rparen'>)</span>
<span class='id identifier rubyid_channel'>channel</span><span class='period'>.</span><span class='id identifier rubyid_topic'>topic</span><span class='lparen'>(</span><span class='id identifier rubyid_exchange'>exchange</span><span class='comma'>,</span> <span class='label'>durable:</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_publish'>publish</span><span class='lparen'>(</span><span class='id identifier rubyid_payload'>payload</span><span class='comma'>,</span> <span class='label'>routing_key:</span> <span class='id identifier rubyid_routing_key'>routing_key</span><span class='comma'>,</span> <span class='label'>persistent:</span> <span class='kw'>true</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
@@ -929,29 +1463,53 @@
</div>
<div class="method_details ">
<h3 class="signature " id="reconnect-instance_method">
- - (<tt>Object</tt>) <strong>reconnect</strong>
+ - (<tt>Bunny::Session</tt>) <strong>reconnect</strong>
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Close and reopen the AMQP connection</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>Bunny::Session</tt>)</span>
+
+
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-96
-97
-98
-99</pre>
+150
+151
+152
+153</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 96</span>
+ <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 150</span>
<span class='kw'>def</span> <span class='id identifier rubyid_reconnect'>reconnect</span>
<span class='id identifier rubyid_close'>close</span>
<span class='id identifier rubyid_connect'>connect</span>
<span class='kw'>end</span></pre>
@@ -967,38 +1525,183 @@
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Reset this client by closing all channels for the connection.</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-72
-73
-74</pre>
+119
+120
+121</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 72</span>
+ <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 119</span>
<span class='kw'>def</span> <span class='id identifier rubyid_reset'>reset</span>
<span class='id identifier rubyid_connection'>connection</span><span class='period'>.</span><span class='id identifier rubyid_close_all_channels'>close_all_channels</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
+ <div class="method_details ">
+ <h3 class="signature " id="subscribe-instance_method">
+
+ - (<tt>Object</tt>) <strong>subscribe</strong>(queue, options = {manual_ack: true}) {|payload| ... }
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Subscribe to messages on the Bunny queue. The provided block will be called
+each time a message is received.</p>
+
+<pre class="code ruby"><code class="ruby">The message will be acknowledged and deleted from the queue unless an exception is raised from the block.
+In the case that an exception is caught, the message is rejected, and any declared exception handlers will
+be called.</code></pre>
+
+
</div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+
+ <li>
+
+ <span class='name'>queue</span>
+
+
+ <span class='type'>(<tt>Bunny::Queue</tt>)</span>
+
+
+
+ —
+ <div class='inline'>
+<p>Bunny queue</p>
+</div>
+
+ </li>
+
+ <li>
+
+ <span class='name'>options</span>
+
+
+ <span class='type'>(<tt>Hash</tt>)</span>
+
+
+ <em class="default">(defaults to: <tt>{manual_ack: true}</tt>)</em>
+
+
+ —
+ <div class='inline'>
+<p>true subscription options – @see Bunny::Queue#subscribe</p>
+</div>
+
+ </li>
+
+</ul>
+<p class="tag_title">Yield Parameters:</p>
+<ul class="yieldparam">
+
+ <li>
+
+ <span class='name'>payload</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'>
+<p>message text</p>
</div>
+
+ </li>
+
+</ul>
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/isimud/bunny_client.rb', line 67</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_subscribe'>subscribe</span><span class='lparen'>(</span><span class='id identifier rubyid_queue'>queue</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>manual_ack:</span> <span class='kw'>true</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_current_channel'>current_channel</span> <span class='op'>=</span> <span class='id identifier rubyid_channel'>channel</span>
+ <span class='id identifier rubyid_queue'>queue</span><span class='period'>.</span><span class='id identifier rubyid_subscribe'>subscribe</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_delivery_info'>delivery_info</span><span class='comma'>,</span> <span class='id identifier rubyid_properties'>properties</span><span class='comma'>,</span> <span class='id identifier rubyid_payload'>payload</span><span class='op'>|</span>
+ <span class='kw'>begin</span>
+ <span class='id identifier rubyid_log'>log</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Isimud: queue </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_queue'>queue</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'> received </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_delivery_info'>delivery_info</span><span class='period'>.</span><span class='id identifier rubyid_delivery_tag'>delivery_tag</span><span class='embexpr_end'>}</span><span class='tstring_content'> routing_key: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_delivery_info'>delivery_info</span><span class='period'>.</span><span class='id identifier rubyid_routing_key'>routing_key</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
+ <span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>isimud_queue_name</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_queue'>queue</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span>
+ <span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>isimud_delivery_info</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_delivery_info'>delivery_info</span>
+ <span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>isimud_properties</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_properties'>properties</span>
+ <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_payload'>payload</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_log'>log</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Isimud: queue </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_queue'>queue</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'> finished with </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_delivery_info'>delivery_info</span><span class='period'>.</span><span class='id identifier rubyid_delivery_tag'>delivery_tag</span><span class='embexpr_end'>}</span><span class='tstring_content'>, acknowledging</span><span class='tstring_end'>"</span></span>
+ <span class='id identifier rubyid_current_channel'>current_channel</span><span class='period'>.</span><span class='id identifier rubyid_ack'>ack</span><span class='lparen'>(</span><span class='id identifier rubyid_delivery_info'>delivery_info</span><span class='period'>.</span><span class='id identifier rubyid_delivery_tag'>delivery_tag</span><span class='rparen'>)</span>
+ <span class='kw'>rescue</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
+ <span class='id identifier rubyid_log'>log</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Isimud: queue </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_queue'>queue</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'> error processing </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_delivery_info'>delivery_info</span><span class='period'>.</span><span class='id identifier rubyid_delivery_tag'>delivery_tag</span><span class='embexpr_end'>}</span><span class='tstring_content'> payload </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_payload'>payload</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_backtrace'>backtrace</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n </span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:warn</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_current_channel'>current_channel</span><span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span><span class='lparen'>(</span><span class='id identifier rubyid_delivery_info'>delivery_info</span><span class='period'>.</span><span class='id identifier rubyid_delivery_tag'>delivery_tag</span><span class='comma'>,</span> <span class='const'>Isimud</span><span class='period'>.</span><span class='id identifier rubyid_retry_failures'>retry_failures</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_run_exception_handlers'>run_exception_handlers</span><span class='lparen'>(</span><span class='id identifier rubyid_e'>e</span><span class='rparen'>)</span>
+ <span class='kw'>end</span>
+ <span class='kw'>end</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ </div>
+
+</div>
+
<div id="footer">
- Generated on Fri Apr 3 09:28:09 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