module Kinetic::DSL
Public Instance Methods
after_fork(&block)
click to toggle source
# File lib/kinetic/dsl.rb, line 12 def after_fork(&block) raise Kinetic::Errors::BlockMissing unless block_given? after_fork_procs << block end
logger()
click to toggle source
@return [Logger] returns the application logger instance
# File lib/kinetic/dsl.rb, line 37 def logger @logger ||= config[:logging] ? reopen_logger : Logger.new('/dev/null') end
on_direct(key, &block)
click to toggle source
Defines a direct queue subscription. Direct queues do not allow fuzzy matching so all messages sent to this queue must exactly match the key.
@param [String] key the key of the queue to which to subscribe.
@yield [message] yields the message passed to the queue to the block
@raise [Kinetic::Errors::NoSubcriberBlock] if a block is not passed @raise [Kinetic::Errors::KeyMustBeString] if the passed key is not a string
# File lib/kinetic/dsl.rb, line 27 def on_direct(key, &block) raise Kinetic::Errors::NoSubscriberBlock unless block_given? raise Kinetic::Errors::KeyMustBeString unless key.is_a? String logger.debug "Setting up '#{key}' on 'direct'" direct[key] = block end
Also aliased as: on
Protected Instance Methods
reopen_logger()
click to toggle source
# File lib/kinetic/dsl.rb, line 43 def reopen_logger @logger = Logger.new(config[:daemonize] ? config.log_file : STDOUT) end