Module Bunny
In: lib/bunny.rb
lib/bunny/channel08.rb
lib/bunny/channel09.rb
lib/bunny/client08.rb
lib/bunny/client09.rb
lib/bunny/exchange08.rb
lib/bunny/exchange09.rb
lib/bunny/queue08.rb
lib/bunny/queue09.rb
lib/bunny/subscription08.rb
lib/bunny/subscription09.rb
StandardError ForcedConnectionCloseError UnsubscribeError ConnectionError ServerDownError AcknowledgementError MessageError ProtocolError ForcedChannelCloseError Qrack::Client Client Client09 Qrack::Channel Channel Channel09 Qrack::Queue Queue09 Queue Qrack::Subscription Subscription09 Subscription Exchange09 Exchange Qrack lib/bunny/exchange09.rb lib/bunny/queue08.rb lib/bunny/exchange08.rb lib/bunny/client09.rb lib/bunny/channel09.rb lib/bunny/queue09.rb lib/bunny/client08.rb lib/bunny.rb lib/bunny/subscription09.rb lib/bunny/subscription08.rb lib/bunny/channel08.rb Bunny dot/m_10_0.png

Methods

new   run   setup   version  

Included Modules

Qrack

Classes and Modules

Class Bunny::AcknowledgementError
Class Bunny::Channel
Class Bunny::Channel09
Class Bunny::Client
Class Bunny::Client09
Class Bunny::ConnectionError
Class Bunny::Exchange
Class Bunny::Exchange09
Class Bunny::ForcedChannelCloseError
Class Bunny::ForcedConnectionCloseError
Class Bunny::MessageError
Class Bunny::ProtocolError
Class Bunny::Queue
Class Bunny::Queue09
Class Bunny::ServerDownError
Class Bunny::Subscription
Class Bunny::Subscription09
Class Bunny::UnsubscribeError

Constants

VERSION = '0.6.0'

Public Class methods

Instantiates new Bunny::Client

[Source]

    # File lib/bunny.rb, line 29
29:         def self.new(opts = {})
30:                 # Set up Bunny according to AMQP spec version required
31:                 spec_version = opts[:spec] || '08'
32: 
33:                 # Return client
34:                 setup(spec_version, opts)
35:         end

Runs a code block using a short-lived connection

[Source]

    # File lib/bunny.rb, line 39
39:   def self.run(opts = {}, &block)
40:     raise ArgumentError, 'Bunny#run requires a block' unless block
41: 
42:                 # Set up Bunny according to AMQP spec version required
43:                 spec_version = opts[:spec] || '08'
44:                 client = setup(spec_version, opts)
45:                 
46:     begin
47:       client.start
48:       block.call(client)
49:     ensure
50:       client.stop
51:     end
52: 
53:                 # Return success
54:                 :run_ok
55:   end

Returns the Bunny version number

[Source]

    # File lib/bunny.rb, line 23
23:         def self.version
24:                 VERSION
25:         end

Private Class methods

[Source]

    # File lib/bunny.rb, line 59
59:         def self.setup(version, opts)  
60:                 if version == '08'
61:                         # AMQP 0-8 specification
62:                         require 'qrack/qrack08'
63:                         require 'bunny/client08'
64:                         require 'bunny/exchange08'
65:                         require 'bunny/queue08'
66:                         require 'bunny/channel08'
67:                         require 'bunny/subscription08'
68:                         
69:                         client = Bunny::Client.new(opts)
70:                 else
71:                         # AMQP 0-9-1 specification
72:                         require 'qrack/qrack09'
73:                         require 'bunny/client09'
74:                         require 'bunny/exchange09'
75:                         require 'bunny/queue09'
76:                         require 'bunny/channel09'
77:                         require 'bunny/subscription09'
78:                         
79:                         client = Bunny::Client09.new(opts)
80:                 end                   
81:                 
82:                 include Qrack
83: 
84:     client
85:         end

[Validate]