Sha256: 0d942822957da8005ab6916add73e69d07e4558572bc72b52f020c414c3b0f62
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
module Embulk class OutputExample < OutputPlugin # output plugin file name must be: embulk/output_<name>.rb Plugin.register_output('example', self) def self.transaction(config, schema, processor_count, &control) task = { 'message' => config.param('message', :string, default: "record") } puts "Example output started." commit_reports = yield(task) puts "Example output finished. Commit reports = #{commit_reports.to_json}" return {} end def initialize(task, schema, index) puts "Example output thread #{index}..." super @message = task.param('message', :string) @records = 0 end def close end def add(page) page.each do |record| hash = Hash[schema.names.zip(record)] puts "#{@message}: #{hash.to_json}" @records += 1 end end def finish end def abort end def commit commit_report = { "records" => @records } return commit_report end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
embulk-0.2.1 | lib/embulk/data/bundle/embulk/output_example.rb |
embulk-0.2.0 | lib/embulk/data/bundle/embulk/output_example.rb |
embulk-0.1.0 | lib/embulk/data/bundle/embulk/output_example.rb |