Class: LogStash::Outputs::Base
- Includes:
- Config::Mixin
- Defined in:
- lib/logstash/outputs/base.rb
Constant Summary
Constants included from Config::Mixin
Config::Mixin::PLUGIN_VERSION_0_9_0, Config::Mixin::PLUGIN_VERSION_1_0_0
Constants inherited from Plugin
Instance Attribute Summary collapse
-
#available_workers ⇒ Object
readonly
Returns the value of attribute available_workers.
-
#worker_plugins ⇒ Object
readonly
Returns the value of attribute worker_plugins.
-
#workers ⇒ Object
readonly
Returns the value of attribute workers.
-
#workers_not_supported(message = nil) ⇒ Object
readonly
TODO: Remove this in the next major version after Logstash 2.x Post 2.x it should raise an error and tell people to use the class level declaration.
Attributes included from Config::Mixin
Attributes inherited from Plugin
Class Method Summary collapse
- .declare_threadsafe! ⇒ Object
- .declare_workers_not_supported!(message = nil) ⇒ Object
- .threadsafe? ⇒ Boolean
- .workers_not_supported? ⇒ Boolean
- .workers_not_supported_message ⇒ Object
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Base
constructor
A new instance of Base.
-
#multi_receive(events) ⇒ Object
To be overriden in implementations.
- #receive(event) ⇒ Object
- #register ⇒ Object
Methods included from Config::Mixin
Methods inherited from Plugin
#close, #debug_info, #do_close, #eql?, #hash, #inspect, lookup, #to_s
Constructor Details
#initialize(params = {}) ⇒ Base
Returns a new instance of Base.
61 62 63 64 65 66 67 68 |
# File 'lib/logstash/outputs/base.rb', line 61 def initialize(params={}) super config_init(@params) # If we're running with a single thread we must enforce single-threaded concurrency by default # Maybe in a future version we'll assume output plugins are threadsafe @single_worker_mutex = Mutex.new end |
Instance Attribute Details
#available_workers ⇒ Object (readonly)
Returns the value of attribute available_workers.
28 29 30 |
# File 'lib/logstash/outputs/base.rb', line 28 def available_workers @available_workers end |
#worker_plugins ⇒ Object (readonly)
Returns the value of attribute worker_plugins.
28 29 30 |
# File 'lib/logstash/outputs/base.rb', line 28 def worker_plugins @worker_plugins end |
#workers ⇒ Object (readonly)
Returns the value of attribute workers.
28 29 30 |
# File 'lib/logstash/outputs/base.rb', line 28 def workers @workers end |
#workers_not_supported(message = nil) ⇒ Object (readonly)
TODO: Remove this in the next major version after Logstash 2.x Post 2.x it should raise an error and tell people to use the class level declaration
56 57 58 |
# File 'lib/logstash/outputs/base.rb', line 56 def workers_not_supported @workers_not_supported end |
Class Method Details
.declare_threadsafe! ⇒ Object
30 31 32 33 |
# File 'lib/logstash/outputs/base.rb', line 30 def self.declare_threadsafe! declare_workers_not_supported! @threadsafe = true end |
.declare_workers_not_supported!(message = nil) ⇒ Object
39 40 41 42 |
# File 'lib/logstash/outputs/base.rb', line 39 def self.declare_workers_not_supported!(=nil) @workers_not_supported_message = @workers_not_supported = true end |
.threadsafe? ⇒ Boolean
35 36 37 |
# File 'lib/logstash/outputs/base.rb', line 35 def self.threadsafe? @threadsafe == true end |
.workers_not_supported? ⇒ Boolean
48 49 50 |
# File 'lib/logstash/outputs/base.rb', line 48 def self.workers_not_supported? !!@workers_not_supported end |
.workers_not_supported_message ⇒ Object
44 45 46 |
# File 'lib/logstash/outputs/base.rb', line 44 def self. @workers_not_supported_message end |
Instance Method Details
#multi_receive(events) ⇒ Object
To be overriden in implementations
82 83 84 |
# File 'lib/logstash/outputs/base.rb', line 82 def multi_receive(events) events.each {|event| receive(event) } end |
#receive(event) ⇒ Object
76 77 78 |
# File 'lib/logstash/outputs/base.rb', line 76 def receive(event) raise "#{self.class}#receive must be overidden" end |
#register ⇒ Object
71 72 73 |
# File 'lib/logstash/outputs/base.rb', line 71 def register raise "#{self.class}#register must be overidden" end |