Class: Mysql::BinlogQueryDispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/flydata/fluent-plugins/mysql/binlog_query_dispatcher.rb

Direct Known Subclasses

FlydataBinlogQueryDispatcher

Instance Method Summary collapse

Constructor Details

#initializeBinlogQueryDispatcher

Returns a new instance of BinlogQueryDispatcher.



7
8
9
# File 'lib/flydata/fluent-plugins/mysql/binlog_query_dispatcher.rb', line 7

def initialize
  @handlers = []
end

Instance Method Details

#dispatch(record) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/flydata/fluent-plugins/mysql/binlog_query_dispatcher.rb', line 11

def dispatch(record)
  normalize_query(record["query"]) do |query|
    @handlers.each do |handler|
      if (handler.pattern.match(query))
        handler.process(record.merge({"normalized_query" => query}))
        break
      end
    end
  end
end