Module: FFWD::Processor
Defined Under Namespace
Modules: ClassMethods Classes: Setup
Class Method Summary collapse
- .category ⇒ Object
- .included(mod) ⇒ Object
- .load_discovered(source) ⇒ Object
-
.load_processors(config) ⇒ Object
setup hash of processor setup classes.
- .registry ⇒ Object
Instance Method Summary collapse
- #name ⇒ Object
-
#process(m) ⇒ Object
Module to include for processors.
Methods included from Logging
Methods included from Lifecycle
#depend_on, #start, #started?, #starting, #starting_hooks, #stop, #stopped?, #stopping, #stopping_hooks
Class Method Details
.category ⇒ Object
81 82 83 |
# File 'lib/ffwd/processor.rb', line 81 def self.category 'processor' end |
.included(mod) ⇒ Object
85 86 87 |
# File 'lib/ffwd/processor.rb', line 85 def self.included(mod) mod.extend ClassMethods end |
.load_discovered(source) ⇒ Object
89 90 |
# File 'lib/ffwd/processor.rb', line 89 def self.load_discovered source end |
.load_processors(config) ⇒ Object
setup hash of processor setup classes.
93 94 95 96 97 98 99 100 101 102 |
# File 'lib/ffwd/processor.rb', line 93 def self.load_processors config registry.map do |name, klass| unless klass.respond_to? :prepare raise "Processor #{klass} does not have a 'prepare' method" end config = klass.prepare Hash[config[name] || {}] Setup.new name, klass, config end end |
.registry ⇒ Object
77 78 79 |
# File 'lib/ffwd/processor.rb', line 77 def self.registry @@registry ||= {} end |
Instance Method Details
#name ⇒ Object
73 74 75 |
# File 'lib/ffwd/processor.rb', line 73 def name self.class.name end |
#process(m) ⇒ Object
Module to include for processors.
Usage:
class MyProcessor
include FFWD::Processor
register_processor "my_processor"
def initialize opts
.. read options ..
end
def start emitter
... setup EventMachine tasks ...
end
def process emitter, m
... process a single metric ...
emitter.metrics.emit ...
end
end
59 60 61 |
# File 'lib/ffwd/processor.rb', line 59 def process m raise Exception.new("process: Not Implemented") end |