Class: Fusuma::Plugin::Inputs::AppmatcherInput

Inherits:
Input
  • Object
show all
Defined in:
lib/fusuma/plugin/inputs/appmatcher_input.rb

Overview

Get active application’s name

Instance Method Summary collapse

Instance Method Details

#create_event(record:) ⇒ Event

TODO: use read_from_io

Parameters:

  • record (String)

    application name

Returns:

  • (Event)


30
31
32
33
34
35
36
37
# File 'lib/fusuma/plugin/inputs/appmatcher_input.rb', line 30

def create_event(record:)
  e = Events::Event.new(
    tag: tag,
    record: Events::Records::AppmatcherRecord.new(name: record)
  )
  MultiLogger.debug(input_event: e)
  e
end

#ioObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fusuma/plugin/inputs/appmatcher_input.rb', line 10

def io
  return @io if instance_variable_defined?(:@io)

  @backend = Appmatcher.backend_klass.new

  @backend.watch_start
  # NOTE: Closing the parent process's pipe
  @backend.writer.close

  @io = @backend.reader
end

#shutdownObject



22
23
24
25
# File 'lib/fusuma/plugin/inputs/appmatcher_input.rb', line 22

def shutdown
  # CustomProcess#shutdown
  @backend.shutdown
end