Skip to content

Commit

Permalink
Use Fluent::MessagePackFactory class methods instead of Mixin - #194
Browse files Browse the repository at this point in the history
  • Loading branch information
simukappu committed Feb 12, 2020
1 parent 7ff9210 commit 2278d0d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ gemfile:
# https://support.treasuredata.com/hc/en-us/articles/360001479187-The-td-agent-ChangeLog
matrix:
include:
- rvm: 2.6.5
gemfile: gemfiles/Gemfile.fluentd-1.9.1 # Latest Fluentd
- rvm: 2.4.1
gemfile: gemfiles/Gemfile.fluentd-0.14.22
gemfile: gemfiles/Gemfile.fluentd-0.14.22 # Oldest supported Fluentd
- rvm: 2.4.2 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.1.0/config/projects/td-agent3.rb#L20
gemfile: gemfiles/Gemfile.td-agent-3.1.0
- rvm: 2.4.2 # https://github.com/treasure-data/omnibus-td-agent/blob/v3.1.1/config/projects/td-agent3.rb#L17
Expand Down
20 changes: 20 additions & 0 deletions gemfiles/Gemfile.fluentd-1.9.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Copyright 2014-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

source 'https://rubygems.org'

# Specify your gem's dependencies in fluent-plugin-kinesis.gemspec
gemspec path: ".."

gem "fluentd", "1.9.1"
11 changes: 10 additions & 1 deletion lib/fluent/plugin/kinesis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

require 'fluent/version'
require 'fluent/msgpack_factory'
require 'fluent/plugin/output'
require 'fluent/plugin/kinesis_helper/client'
require 'fluent/plugin/kinesis_helper/api'
Expand All @@ -20,7 +22,6 @@
module Fluent
module Plugin
class KinesisOutput < Fluent::Plugin::Output
include Fluent::MessagePackFactory::Mixin
include KinesisHelper::Client
include KinesisHelper::API

Expand Down Expand Up @@ -133,6 +134,14 @@ def format_for_api(&block)
''
end

if Gem::Version.new(Fluent::VERSION) >= Gem::Version.new('1.8.0')
def msgpack_unpacker(*args)
Fluent::MessagePackFactory.msgpack_unpacker(*args)
end
else
include Fluent::MessagePackFactory::Mixin
end

def write_records_batch(chunk, &block)
unique_id = chunk.dump_unique_id_hex(chunk.unique_id)
chunk.open do |io|
Expand Down

0 comments on commit 2278d0d

Please sign in to comment.