Module: Fluent::PluginHelper::EventEmitter
- Defined in:
- lib/fluent/plugin_helper/event_emitter.rb
Instance Method Summary collapse
- #after_shutdown ⇒ Object
-
#close ⇒ Object
unset router many times to reduce test cost.
- #configure(conf) ⇒ Object
- #event_emitter_router(label_name) ⇒ Object
- #event_emitter_used_actually? ⇒ Boolean
- #has_router? ⇒ Boolean
- #initialize ⇒ Object
-
#router ⇒ Object
stop : [-] shutdown : disable @router close : [-] terminate: [-].
- #router=(r) ⇒ Object
- #terminate ⇒ Object
Instance Method Details
#after_shutdown ⇒ Object
77 78 79 80 |
# File 'lib/fluent/plugin_helper/event_emitter.rb', line 77 def after_shutdown @router = nil super end |
#close ⇒ Object
unset router many times to reduce test cost
82 83 84 85 |
# File 'lib/fluent/plugin_helper/event_emitter.rb', line 82 def close # unset router many times to reduce test cost @router = nil super end |
#configure(conf) ⇒ Object
71 72 73 74 75 |
# File 'lib/fluent/plugin_helper/event_emitter.rb', line 71 def configure(conf) require 'fluent/engine' super @router = event_emitter_router(conf['@label']) end |
#event_emitter_router(label_name) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/fluent/plugin_helper/event_emitter.rb', line 48 def event_emitter_router(label_name) if label_name Engine.root_agent.find_label(label_name).event_router elsif self.respond_to?(:as_secondary) && self.as_secondary if @primary_instance.has_router? @_event_emitter_lazy_init = true nil # primary plugin's event router is not initialized yet, here. else @primary_instance.context_router end else # `Engine.root_agent.event_router` is for testing self.context_router || Engine.root_agent.event_router end end |
#event_emitter_used_actually? ⇒ Boolean
44 45 46 |
# File 'lib/fluent/plugin_helper/event_emitter.rb', line 44 def event_emitter_used_actually? @_event_emitter_used_actually end |
#has_router? ⇒ Boolean
40 41 42 |
# File 'lib/fluent/plugin_helper/event_emitter.rb', line 40 def has_router? true end |
#initialize ⇒ Object
64 65 66 67 68 69 |
# File 'lib/fluent/plugin_helper/event_emitter.rb', line 64 def initialize super @_event_emitter_used_actually = false @_event_emitter_lazy_init = false @router = nil end |
#router ⇒ Object
stop : [-] shutdown : disable @router close : [-] terminate: [-]
27 28 29 30 31 32 33 |
# File 'lib/fluent/plugin_helper/event_emitter.rb', line 27 def router @_event_emitter_used_actually = true if @_event_emitter_lazy_init @router = @primary_instance.router end @router end |
#router=(r) ⇒ Object
35 36 37 38 |
# File 'lib/fluent/plugin_helper/event_emitter.rb', line 35 def router=(r) # not recommended now... @router = r end |
#terminate ⇒ Object
87 88 89 90 |
# File 'lib/fluent/plugin_helper/event_emitter.rb', line 87 def terminate @router = nil super end |