Module: Fluent::PluginHelper::HttpServer
- Includes:
 - Configurable, Thread
 
- Defined in:
 - lib/fluent/plugin_helper/http_server.rb,
lib/fluent/plugin_helper/http_server/app.rb,
lib/fluent/plugin_helper/http_server/router.rb,
lib/fluent/plugin_helper/http_server/server.rb,
lib/fluent/plugin_helper/http_server/methods.rb,
lib/fluent/plugin_helper/http_server/request.rb,
lib/fluent/plugin_helper/http_server/ssl_context_builder.rb 
Defined Under Namespace
Modules: Methods Classes: App, Request, Router, SSLContextBuilder, Server
Constant Summary
Constants included from Configurable
Configurable::CONFIG_TYPE_REGISTRY
Constants included from Thread
Thread::THREAD_DEFAULT_WAIT_SECONDS, Thread::THREAD_SHUTDOWN_HARD_TIMEOUT_IN_TESTS
Instance Attribute Summary
Attributes included from Thread
Class Method Summary collapse
- 
  
    
      .included(mod)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
stop : stop http server and mark callback thread as stopped shutdown : [-] close : correct stopped threads terminate: kill thread.
 
Instance Method Summary collapse
- #create_http_server(title, addr:, port:, logger:, default_app: nil, proto: nil, tls_opts: nil, &block) ⇒ Object
 - #http_server_create_http_server(title, addr:, port:, logger:, default_app: nil, proto: nil, tls_opts: nil, &block) ⇒ Object
 - #http_server_create_https_server(title, addr:, port:, logger:, default_app: nil, tls_opts: nil) ⇒ Object
 - #initialize ⇒ Object
 - #stop ⇒ Object
 
Methods included from Configurable
#config, #configure, #configure_proxy_generate, #configured_section_create, lookup_type, register_type
Methods included from Thread
#after_shutdown, #close, #terminate, #thread_create, #thread_current_running?, #thread_exist?, #thread_running?, #thread_started?, #thread_wait_until_start, #thread_wait_until_stop
Class Method Details
.included(mod) ⇒ Object
stop : stop http server and mark callback thread as stopped shutdown : [-] close : correct stopped threads terminate: kill thread
      33 34 35  | 
    
      # File 'lib/fluent/plugin_helper/http_server.rb', line 33 def self.included(mod) mod.include Fluent::PluginHelper::Server::ServerTransportParams end  | 
  
Instance Method Details
#create_http_server(title, addr:, port:, logger:, default_app: nil, proto: nil, tls_opts: nil, &block) ⇒ Object
      42 43 44 45  | 
    
      # File 'lib/fluent/plugin_helper/http_server.rb', line 42 def create_http_server(title, addr:, port:, logger:, default_app: nil, proto: nil, tls_opts: nil, &block) logger.warn('this method is deprecated. Use #http_server_create_http_server instead') http_server_create_http_server(title, addr: addr, port: port, logger: logger, default_app: default_app, proto: proto, tls_opts: tls_opts, &block) end  | 
  
#http_server_create_http_server(title, addr:, port:, logger:, default_app: nil, proto: nil, tls_opts: nil, &block) ⇒ Object
      54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72  | 
    
      # File 'lib/fluent/plugin_helper/http_server.rb', line 54 def http_server_create_http_server(title, addr:, port:, logger:, default_app: nil, proto: nil, tls_opts: nil, &block) unless block_given? raise ArgumentError, 'BUG: callback not specified' end if proto == :tls || (@transport_config && @transport_config.protocol == :tls) http_server_create_https_server(title, addr: addr, port: port, logger: logger, default_app: default_app, tls_opts: tls_opts, &block) else @_http_server = HttpServer::Server.new(addr: addr, port: port, logger: logger, default_app: default_app) do |serv| yield(serv) end _block_until_http_server_start do |notify| thread_create(title) do @_http_server.start(notify) end end end end  | 
  
#http_server_create_https_server(title, addr:, port:, logger:, default_app: nil, tls_opts: nil) ⇒ Object
      80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98  | 
    
      # File 'lib/fluent/plugin_helper/http_server.rb', line 80 def http_server_create_https_server(title, addr:, port:, logger:, default_app: nil, tls_opts: nil) topt = if tls_opts _http_server_overwrite_config(@transport_config, tls_opts) else @transport_config end ctx = Fluent::PluginHelper::HttpServer::SSLContextBuilder.new($log).build(topt) @_http_server = HttpServer::Server.new(addr: addr, port: port, logger: logger, default_app: default_app, tls_context: ctx) do |serv| yield(serv) end _block_until_http_server_start do |notify| thread_create(title) do @_http_server.start(notify) end end end  | 
  
#initialize ⇒ Object
      37 38 39 40  | 
    
      # File 'lib/fluent/plugin_helper/http_server.rb', line 37 def initialize(*) super @_http_server = nil end  | 
  
#stop ⇒ Object
      100 101 102 103 104 105 106  | 
    
      # File 'lib/fluent/plugin_helper/http_server.rb', line 100 def stop if @_http_server @_http_server.stop end super end  |