Class: LogStash::Outputs::Charrington
- Inherits:
-
Base
- Object
- Base
- LogStash::Outputs::Charrington
- Defined in:
- lib/logstash/outputs/charrington.rb
Overview
This class is responsible for setting things up, creating the connection, and handling retries. Charrington::Insert is where the insert is attempted. If that fails, it will try to either create a table via Charrington::CreateTable or alter an existing one via Charrington::AlterTable
Constant Summary collapse
- STRFTIME_FMT =
'%Y-%m-%d %T.%L'
Instance Method Summary collapse
Instance Method Details
#close ⇒ Object
121 122 123 124 125 |
# File 'lib/logstash/outputs/charrington.rb', line 121 def close @stopping.make_true @pool.close super end |
#multi_receive(events) ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/logstash/outputs/charrington.rb', line 99 def multi_receive(events) events.each do |event| conn = connection break unless conn schema = get_schema(event) opts = { connection: conn, schema: schema, max_retries: @max_flush_exceptions, retry_initial_interval: @retry_initial_interval, driver: driver, transformer: @transformer } Charrington::Process.call(conn, event, opts) rescue StandardError => e @logger.error("Unable to process event. Event dropped. #{e.message}") next ensure conn&.close end end |
#register ⇒ Object
90 91 92 93 94 95 96 97 |
# File 'lib/logstash/outputs/charrington.rb', line 90 def register @logger.info('JDBC - Starting up') load_jar_files! @stopping = Concurrent::AtomicBoolean.new(false) setup_and_test_pool! end |