Module: WaterDrop::Pool

Extended by:
SingleForwardable
Defined in:
lib/water_drop/pool.rb

Overview

Raw poseidon connection pool for WaterDrop messages delivery

Class Method Summary collapse

Class Method Details

.pool::ConnectionPool

Returns connection pool instance that we can then use.

Returns:

  • (::ConnectionPool)

    connection pool instance that we can then use



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/water_drop/pool.rb', line 10

def pool
  @pool ||= ConnectionPool.new(
    size: ::WaterDrop.config.connection_pool_size,
    timeout: ::WaterDrop.config.connection_pool_timeout
  ) do
    addresses = ::WaterDrop.config.kafka_ports.map do |port|
      "#{::WaterDrop.config.kafka_host}:#{port}"
    end

    Poseidon::Producer.new(addresses, object_id.to_s)
  end
end