Method: LogStash::Filters::Jdbc::LookupProcessor#initialize

Defined in:
lib/logstash/filters/jdbc/lookup_processor.rb

#initialize(lookups_array, globals) ⇒ LookupProcessor

Returns a new instance of LookupProcessor.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/logstash/filters/jdbc/lookup_processor.rb', line 30

def initialize(lookups_array, globals)
  @lookups = lookups_array.map.with_index do |options, i|
    Lookup.new(options, globals, "lookup-#{i.next}")
  end
  @lookups_errors = validate_lookups
  if @lookups_errors.empty? && !globals.empty?
    @local = ReadWriteDatabase.create(*globals.values_at(
      "lookup_jdbc_connection_string",
      "lookup_jdbc_driver_class",
      "lookup_jdbc_driver_library").compact)
    @local.connect(CONNECTION_ERROR_MSG)

    create_prepared_statements_for_lookups
  end
end