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.



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

def initialize
  @handlers = []
end

Instance Method Details

#dispatch(record) ⇒ Object



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

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