Class: MicroBunny::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/microbunny/connection.rb

Instance Method Summary collapse

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

#channelObject



14
15
16
# File 'lib/microbunny/connection.rb', line 14

def channel
  @channel ||= conn.create_channel
end

#stopObject



18
19
20
# File 'lib/microbunny/connection.rb', line 18

def stop
  conn.close
end