Method: Fluent::Plugin::PostgresReplicatorInput#get_connection

Defined in:
lib/fluent/plugin/in_postgres_replicator.rb

#get_connectionObject



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/fluent/plugin/in_postgres_replicator.rb', line 109

def get_connection
  begin
    return PG::Connection.new({
      :host => @host,
      :port => @port,
      :user => @username,
      :password => @password,
      :dbname => @database
    })
  rescue Exception => e
    log.warn "failed to get connection and will retry. error: #{e}"
    sleep @interval
    retry
  end
end