Class: Outboxable::Connection

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/outboxable/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConnection

Returns a new instance of Connection.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/outboxable/connection.rb', line 8

def initialize
  @connection = Bunny.new(
    host: Outboxable.configuration.rabbitmq_host,
    port: Outboxable.configuration.rabbitmq_port,
    user: Outboxable.configuration.rabbitmq_user,
    password: Outboxable.configuration.rabbitmq_password,
    vhost: Outboxable.configuration.rabbitmq_vhost
  )

  @connection.start
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



6
7
8
# File 'lib/outboxable/connection.rb', line 6

def connection
  @connection
end

Instance Method Details

#channelObject



20
21
22
23
24
# File 'lib/outboxable/connection.rb', line 20

def channel
  @channel ||= ConnectionPool.new do
    connection.create_channel
  end
end