Class: Fluent::ReemitOutput::V10Engine
- Inherits:
-
Object
- Object
- Fluent::ReemitOutput::V10Engine
- Defined in:
- lib/fluent/plugin/out_reemit.rb
Instance Method Summary collapse
- #emit_stream(tag, es) ⇒ Object
-
#initialize(reemit) ⇒ V10Engine
constructor
A new instance of V10Engine.
- #match(tag) ⇒ Object
Constructor Details
#initialize(reemit) ⇒ V10Engine
Returns a new instance of V10Engine.
135 136 137 138 139 |
# File 'lib/fluent/plugin/out_reemit.rb', line 135 def initialize(reemit) @reemit = reemit @matches = Engine.matches @match_cache = {} end |
Instance Method Details
#emit_stream(tag, es) ⇒ Object
141 142 143 144 145 146 147 148 |
# File 'lib/fluent/plugin/out_reemit.rb', line 141 def emit_stream(tag, es) target = @match_cache[tag] unless target target = match(tag) || Fluent::EngineClass::NoMatchMatch.new @match_cache[tag] = target end target.emit(tag, es) end |
#match(tag) ⇒ Object
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/fluent/plugin/out_reemit.rb', line 150 def match(tag) # We want to reemit messages to the next `<match>` below this `type reemit` # to avoid reemiting back to an above or current `<match>` found_reemit = false @matches.find do |m| if m.match(tag) if found_reemit && !@reemit.included?(m.output) true elsif !found_reemit && @reemit.included?(m.output) found_reemit = true false end end end end |