Class: Capturing::ForwardRunner
Instance Method Summary collapse
-
#initialize(e, host:, port:, fluentd_config: nil) ⇒ ForwardRunner
constructor
A new instance of ForwardRunner.
- #on_packet(data) ⇒ Object
Methods inherited from Runner
Constructor Details
#initialize(e, host:, port:, fluentd_config: nil) ⇒ ForwardRunner
Returns a new instance of ForwardRunner.
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/capture.rb', line 79 def initialize(e, host:, port:, fluentd_config: nil) super e @host = host @port = port @fluentd_config = fluentd_config (fluentd_config) unless fluentd_config.nil? @sock = new_socket_to_forward @messaging_thread_pool = ThreadPool.new(4) # TODO configurable end |
Instance Method Details
#on_packet(data) ⇒ Object
90 91 92 93 |
# File 'lib/capture.rb', line 90 def on_packet(data) @messaging_thread_pool.process{ @sock.write data } @exec.logger.info "Forwarded message to #{@host}:#{@port}" unless @use_embed_fluentd end |