Module: Fluent::PluginMixin::Redis
- Defined in:
- lib/fluent/plugin_mixin/redis.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ NilClass
Initialize new input plugin.
-
#shutdown_redis ⇒ NilClass
Destroy the Redis connection object.
-
#start_redis ⇒ Redis
Prepare the Redis conncection object.
Class Method Details
.included(base) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/fluent/plugin_mixin/redis.rb', line 5 def self.included(base) base.class_eval do # redis connection details config_param :host, :string, :default => '127.0.0.1' config_param :port, :integer, :default => 6379 config_param :path, :string, :default => nil config_param :password, :string, :default => nil config_param :db, :integer, :default => 0 config_param :timeout, :float, :default => 5.0 config_param :driver, :string, :default => "ruby" # redis list details # - key: redis key of type `list` to fetch messages from # - command: redis command to execute when fetching messages # - batch_size: if greater than 0, fetch messages in batches config_param :key, :string, :default => nil # worker parameters # - poll_inteval: interval between message polling actions # *NOTE*: Apparently this must be greather than 0 # - sleep_interval: interval to wait after receiving 0 messages # - retry_interval: interval to wait before retrying after an error config_param :poll_interval, :float, :default => 1 config_param :sleep_interval, :float, :default => 5 config_param :retry_interval, :float, :default => 5 attr_reader :redis end end |
Instance Method Details
#initialize ⇒ NilClass
Initialize new input plugin
38 39 40 41 |
# File 'lib/fluent/plugin_mixin/redis.rb', line 38 def initialize require 'redis' super end |
#shutdown_redis ⇒ NilClass
Destroy the Redis connection object
61 62 63 |
# File 'lib/fluent/plugin_mixin/redis.rb', line 61 def shutdown_redis @redis.quit end |
#start_redis ⇒ Redis
Prepare the Redis conncection object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/fluent/plugin_mixin/redis.rb', line 46 def start_redis @redis = ::Redis.new( :host => @host, :port => @port, :db => @db, :driver => @driver, :timeout => @timeout, :password => @password, :thread_safe => true ) end |