Class: MicroBunny::Connection
- Inherits:
-
Object
- Object
- MicroBunny::Connection
- Defined in:
- lib/microbunny/connection.rb
Instance Method Summary collapse
- #channel ⇒ Object
-
#initialize(adapter:, host:, vhost: nil, username: 'guest', password: 'guest') ⇒ Connection
constructor
A new instance of Connection.
- #stop ⇒ Object
Constructor Details
#initialize(adapter:, host:, vhost: nil, username: 'guest', password: 'guest') ⇒ Connection
Returns a new instance of Connection.
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/microbunny/connection.rb', line 3 def initialize(adapter:, host:, vhost: nil, username: 'guest', password: 'guest') @conn = adapter.new( host, vhost: vhost, username: username, password: password, continuation_timeout: 10000 ) conn.start end |
Instance Method Details
#channel ⇒ Object
14 15 16 |
# File 'lib/microbunny/connection.rb', line 14 def channel @channel ||= conn.create_channel end |
#stop ⇒ Object
18 19 20 |
# File 'lib/microbunny/connection.rb', line 18 def stop conn.close end |