Class: Fluent::MysqlBinlogQueryHandler

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

Direct Known Subclasses

FlydataMysqlBinlogQueryHandler

Instance Method Summary collapse

Constructor Details

#initializeMysqlBinlogQueryHandler

Returns a new instance of MysqlBinlogQueryHandler.



195
196
197
# File 'lib/flydata/fluent-plugins/in_mysql_binlog_flydata.rb', line 195

def initialize
  @mapping_table = []
end

Instance Method Details

#dispatch(record) ⇒ Object



199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/flydata/fluent-plugins/in_mysql_binlog_flydata.rb', line 199

def dispatch(record)
  @mapping_table.each do |pattern, method_name|
    query = normalize_query(record["query"])
    if (pattern.match(query))
      if (self.respond_to?(method_name))
        self.send(method_name, record, query)
      else
        raise "method '#{method_name}' is not defined in #{self.class.name} although its matching pattern is defined"
      end
      break
    end
  end
end