fluent-plugin-sqs 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,24 +21,28 @@ Store fluent-event as queue message to amazon SQS.
21
21
 
22
22
  aws_key_id {your_aws_key_id}
23
23
  aws_sec_key {your_aws_secret_key}
24
-  queue_name {queue_instance_key}
24
+ queue_name {queue_instance_key}
25
25
 
26
26
  # following attibutes are optional
27
27
   
28
28
  sqs_endpoint {endpointURL}
29
29
 
30
30
  ### endpoint list ###
31
- # Tokyo(Default) : sqs.ap-northeast-1.amazonaws.com
32
- # Singapore : sqs.ap-southeast-1.amazonaws.com
33
- # US-East : sqs.us-east-1.amazonaws.com
34
- # US-West : sqs.us-west-1.amazonaws.com
35
- # EU-West : sqs.eu-west-1.amazonaws.com
31
+ # Asia Pacific (Tokyo) [Default] : sqs.ap-northeast-1.amazonaws.com
32
+ # Asia Pacific (Singapore) : sqs.ap-southeast-1.amazonaws.com
33
+ # US-East (Virginia) : sqs.us-east-1.amazonaws.com
34
+ # US-West (Oregon) : sqs.us-west-2.amazonaws.com
35
+ # US-West (N.California) : sqs.us-west-1.amazonaws.com
36
+ # EU-West (Ireland) : sqs.eu-west-1.amazonaws.com
37
+ # South America (São Paulo) : sns.sa-east-1.amazonaws.com
38
+
39
+ delay_seconds {delivery_deley_seconds}
36
40
 
37
41
  </match>
38
42
 
39
43
  == TODO
40
44
 
41
- === More configuration
45
+ === input plugin
42
46
 
43
47
  == Tool
44
48
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -0,0 +1,64 @@
1
+ module Fluent
2
+
3
+ require 'aws-sdk'
4
+
5
+ class SQSOutput < BufferedOutput
6
+
7
+ Fluent::Plugin.register_output('sqs', self)
8
+
9
+ include SetTagKeyMixin
10
+ config_set_default :include_tag_key, false
11
+
12
+ include SetTimeKeyMixin
13
+ config_set_default :include_time_key, true
14
+
15
+ config_param :aws_key_id, :string
16
+ config_param :aws_sec_key, :string
17
+ config_param :queue_name, :string
18
+ config_param :sqs_endpoint, :string, :default => 'sqs.ap-northeast-1.amazonaws.com'
19
+ config_param :delay_seconds, :integer, :default => 0
20
+ #config_param :buffer_queue_limit, :integer, :default => 10
21
+
22
+ def configure(conf)
23
+ super
24
+ end
25
+
26
+ def start
27
+ super
28
+
29
+ AWS.config(
30
+ :access_key_id => @aws_key_id,
31
+ :secret_access_key => @aws_sec_key,
32
+ :sqs_endpoint => @sqs_endpoint )
33
+
34
+ @sqs = AWS::SQS.new
35
+ @queue = @sqs.queues.create(@queue_name)
36
+
37
+ loop do
38
+ records = [{ :message_body => "abcdefg"},{ :message_body => "12345"}]
39
+ @queue.batch_send(records)
40
+ end
41
+
42
+ end
43
+
44
+ def shutdown
45
+ super
46
+ end
47
+
48
+ def format(tag, time, record)
49
+ record.to_msgpack
50
+ end
51
+
52
+ def write(chunk)
53
+ records = []
54
+ chunk.msgpack_each {|record| records << { :message_body => record.to_json, :delay_seconds => @delay_seconds } }
55
+ until records.length <= 0 do
56
+ begin
57
+ @queue.batch_send(records.slice!(0..9))
58
+ rescue => e
59
+ $stderr.puts e
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -34,11 +34,6 @@ module Fluent
34
34
  @sqs = AWS::SQS.new
35
35
  @queue = @sqs.queues.create(@queue_name)
36
36
 
37
- loop do
38
- records = [{ :message_body => "abcdefg"},{ :message_body => "12345"}]
39
- @queue.batch_send(records)
40
- end
41
-
42
37
  end
43
38
 
44
39
  def shutdown
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-sqs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-02 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd
16
- requirement: &70146417674160 !ruby/object:Gem::Requirement
16
+ requirement: &70291989308420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.10.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70146417674160
24
+ version_requirements: *70291989308420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: aws-sdk
27
- requirement: &70146417673600 !ruby/object:Gem::Requirement
27
+ requirement: &70291989307460 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 1.3.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70146417673600
35
+ version_requirements: *70291989307460
36
36
  description:
37
37
  email: ixixizko@gmail.com
38
38
  executables: []
@@ -43,6 +43,7 @@ files:
43
43
  - AUTHORS
44
44
  - Rakefile
45
45
  - VERSION
46
+ - lib/fluent/plugin/in_sqs.rb
46
47
  - lib/fluent/plugin/out_sqs.rb
47
48
  - README.rdoc
48
49
  homepage: http://github.com/fluent