fluent-plugin-amqp 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Hiromi Ishii
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = fluent-plugin-amqp
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to fluent-plugin-amqp
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2011 Hiromi Ishii. See LICENSE.txt for
18
+ further details.
19
+
@@ -0,0 +1,56 @@
1
+ module Fluent
2
+ class AMQPInput < Input
3
+ Fluent::Plugin.register_input('amqp', self)
4
+
5
+ config_param :tag, :string, :default => "hunter.amqp"
6
+
7
+ config_param :host, :string, :default => nil
8
+ config_param :user, :string, :default => "guest"
9
+ config_param :pass, :string, :default => "guest"
10
+ config_param :vhost, :string, :default => "/"
11
+ config_param :port, :integer, :default => 5672
12
+ config_param :queue, :string, :default => nil
13
+ config_param :durable, :bool, :default => false
14
+ config_param :exclusive, :bool, :default => false
15
+ config_param :auto_delete, :bool, :default => false
16
+ config_param :passive, :bool, :default => false
17
+
18
+ def initialize
19
+ require 'bunny'
20
+ super
21
+ end
22
+
23
+
24
+ def configure(conf)
25
+ super
26
+ @conf = conf
27
+ unless @host && @queue
28
+ raise ConfigError, "'host' and 'queue' must be all specified."
29
+ end
30
+ @bunny = Bunny.new(:host => @host, :port => @port, :vhost => @vhost,
31
+ :pass => @pass, :user => @user)
32
+ end
33
+
34
+ def start
35
+ super
36
+ @thread = Thread.new(&method(:run))
37
+ end
38
+
39
+ def shutdown
40
+ @bunny.stop
41
+ @thread.join
42
+ super
43
+ end
44
+
45
+ def run
46
+ @bunny.start
47
+ q = @bunny.queue(@queue, :passive => @passive, :durable => @durable,
48
+ :exclusive => @exclusive, :auto_delete => @auto_delete)
49
+ q.subscribe do |msg|
50
+ Engine.emit(@tag, Time.new.to_i, msg[:payload])
51
+ end
52
+ end # AMQPInput#run
53
+
54
+ end # class AMQPInput
55
+
56
+ end # module Fluent
@@ -0,0 +1,57 @@
1
+ module Fluent
2
+ class AMQPOutput < BufferedOutput
3
+ Plugin.register_output("amqp", self)
4
+
5
+ config_param :host, :string, :default => nil
6
+ config_param :user, :string, :default => "guest"
7
+ config_param :pass, :string, :default => "guest"
8
+ config_param :vhost, :string, :default => "/"
9
+ config_param :port, :integer, :default => 5672
10
+ config_param :exchange, :string, :default => ""
11
+ config_param :exchange_type, :string, :default => "direct"
12
+ config_param :passive, :bool, :default => false
13
+ config_param :durable, :bool, :default => false
14
+ config_param :auto_delete, :bool, :default => false
15
+ config_param :key, :string, :default => nil
16
+ config_param :persistent, :bool, :default => false
17
+
18
+ def initialize
19
+ super
20
+ require "bunny"
21
+ end
22
+
23
+ def configure(conf)
24
+ super
25
+ @conf = conf
26
+ unless @host && @exchange && @key
27
+ raise ConfigError, "'host', 'exchange' and 'key' must be all specified."
28
+ end
29
+ @bunny = Bunny.new(:host => @host, :port => @port, :vhost => @vhost,
30
+ :pass => @pass, :user => @user)
31
+ end
32
+
33
+ def start
34
+ super
35
+ @bunny.start
36
+ @exch = @bunny.exchange(@exchange, :type => @exchange_type.intern,
37
+ :passive => @passive, :durable => @durable,
38
+ :auto_delete => @auto_delete)
39
+ end
40
+
41
+ def shutdown
42
+ super
43
+ @bunny.stop
44
+ end
45
+
46
+ def format(tag, time, record)
47
+ record.to_msgpack
48
+ end
49
+
50
+ def write(chunk)
51
+ chunk.msgpack_each do |data|
52
+ @exch.publish(data, :key => @key, :persistent => @persistent)
53
+ end
54
+ end
55
+
56
+ end
57
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-amqp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Hiromi Ishii
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-11-17 00:00:00.000000000 +09:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: fluentd
17
+ requirement: &2153401780 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 0.10.5
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *2153401780
26
+ - !ruby/object:Gem::Dependency
27
+ name: bunny
28
+ requirement: &2153535480 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.7.8
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: *2153535480
37
+ - !ruby/object:Gem::Dependency
38
+ name: shoulda
39
+ requirement: &2156188460 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *2156188460
48
+ - !ruby/object:Gem::Dependency
49
+ name: bundler
50
+ requirement: &2156183420 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: 1.0.0
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: *2156183420
59
+ - !ruby/object:Gem::Dependency
60
+ name: jeweler
61
+ requirement: &2156174740 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ~>
65
+ - !ruby/object:Gem::Version
66
+ version: 1.6.4
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: *2156174740
70
+ - !ruby/object:Gem::Dependency
71
+ name: rcov
72
+ requirement: &2156171660 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: *2156171660
81
+ description: AMQP input/output plugin for fluentd
82
+ email: konn.jinro@gmail.com
83
+ executables: []
84
+ extensions: []
85
+ extra_rdoc_files:
86
+ - LICENSE.txt
87
+ - README.rdoc
88
+ files:
89
+ - lib/fluent/plugin/in_amqp.rb
90
+ - lib/fluent/plugin/out_amqp.rb
91
+ - LICENSE.txt
92
+ - README.rdoc
93
+ has_rdoc: true
94
+ homepage: http://github.com/konn/fluent-plugin-amqp
95
+ licenses:
96
+ - Apache License, Version 2.0
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ segments:
108
+ - 0
109
+ hash: -1188625224371297305
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ! '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ requirements: []
117
+ rubyforge_project:
118
+ rubygems_version: 1.6.2
119
+ signing_key:
120
+ specification_version: 3
121
+ summary: AMQP input/output plugin or fluentd
122
+ test_files: []