Class: Flydata::SourceMysql::PluginSupport::BinlogQueryDispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/flydata/source_mysql/plugin_support/binlog_query_dispatcher.rb

Direct Known Subclasses

FlydataBinlogQueryDispatcher

Instance Method Summary collapse

Constructor Details

#initializeBinlogQueryDispatcher

Returns a new instance of BinlogQueryDispatcher.


13
14
15
# File 'lib/flydata/source_mysql/plugin_support/binlog_query_dispatcher.rb', line 13

def initialize
  @handlers = []
end

Instance Method Details

#dispatch(record) ⇒ Object


17
18
19
20
21
22
23
24
25
26
# File 'lib/flydata/source_mysql/plugin_support/binlog_query_dispatcher.rb', line 17

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