Class: LogStash::Inputs::Beats::CodecCallbackListener

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/inputs/beats/codec_callback_listener.rb

Overview

Use the new callback based approch instead of using blocks so we can retain some context of the execution, and make it easier to test

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, hash, path, transformer, queue) ⇒ CodecCallbackListener

Returns a new instance of CodecCallbackListener.



13
14
15
16
17
18
19
# File 'lib/logstash/inputs/beats/codec_callback_listener.rb', line 13

def initialize(data, hash, path, transformer, queue)
  @data = data
  @hash = hash 
  @path = path
  @queue = queue
  @transformer = transformer
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



8
9
10
# File 'lib/logstash/inputs/beats/codec_callback_listener.rb', line 8

def data
  @data
end

#pathObject

The path acts as the ‘stream_identity`, usefull when the clients is reading multiples files



11
12
13
# File 'lib/logstash/inputs/beats/codec_callback_listener.rb', line 11

def path
  @path
end

Instance Method Details

#process_event(event) ⇒ Object



21
22
23
24
# File 'lib/logstash/inputs/beats/codec_callback_listener.rb', line 21

def process_event(event)
  @transformer.transform(event, @hash)
  @queue << event
end