Class: Fluent::Plugin::NetflowipfixInput::PortConnection

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/in_netflowipfix.rb

Instance Method Summary collapse

Constructor Details

#initialize(bind, port, tag, cache_ttl, definitions, queuesleep, log) ⇒ PortConnection

Returns a new instance of PortConnection.



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/fluent/plugin/in_netflowipfix.rb', line 33

def initialize(bind, port, tag, cache_ttl, definitions, queuesleep, log)
	@bind = bind
	@port = port
	@tag = tag
	@cache_ttl = cache_ttl
	@definitions = definitions
	@eventQueue = Queue.new
	@udpQueue = Queue.new
	@queuesleep = queuesleep
	@log = log
end

Instance Method Details

#bindObject



45
46
47
# File 'lib/fluent/plugin/in_netflowipfix.rb', line 45

def bind
	@bind
end

#event_popObject



78
79
80
# File 'lib/fluent/plugin/in_netflowipfix.rb', line 78

def event_pop
	@eventQueue.pop
end

#event_queue_lengthObject



82
83
84
# File 'lib/fluent/plugin/in_netflowipfix.rb', line 82

def event_queue_length
	@eventQueue.length
end

#portObject



48
49
50
# File 'lib/fluent/plugin/in_netflowipfix.rb', line 48

def port
	@port
end

#restartParserObject

def stop



68
69
70
71
72
73
74
75
76
# File 'lib/fluent/plugin/in_netflowipfix.rb', line 68

def restartParser
	if !@thread_parser.nil?
		@thread_parser.close
		@thread_parser.join
		@thread_parser = nil
	end
	@thread_parser = ParserThread.new(@udpQueue, @queuesleep, @eventQueue, @cache_ttl, @definitions, @log)
	@thread_parser.start
end

#startObject



55
56
57
58
59
60
# File 'lib/fluent/plugin/in_netflowipfix.rb', line 55

def start
	@thread_udp = UdpListenerThread.new(@bind, @port, @udpQueue, @tag, @log)
	@thread_parser = ParserThread.new(@udpQueue, @queuesleep, @eventQueue, @cache_ttl, @definitions, @log)
	@thread_udp.start
	@thread_parser.start
end

#stopObject

def start



61
62
63
64
65
66
# File 'lib/fluent/plugin/in_netflowipfix.rb', line 61

def stop
		@thread_udp.close
		@thread_udp.join
		@thread_parser.close
		@thread_parser.join
end

#tagObject



51
52
53
# File 'lib/fluent/plugin/in_netflowipfix.rb', line 51

def tag
	@tag
end