Class: Flapjack::Gateways::Jabber::Notifier
- Inherits:
-
Object
- Object
- Flapjack::Gateways::Jabber::Notifier
- Includes:
- Utility
- Defined in:
- lib/flapjack/gateways/jabber.rb
Instance Attribute Summary collapse
-
#siblings ⇒ Object
Returns the value of attribute siblings.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Notifier
constructor
A new instance of Notifier.
- #start ⇒ Object
- #stop_type ⇒ Object
Methods included from Utility
#hashify, #load_template, #local_timezone, #relative_time_ago, #remove_utc_offset, #stringify, #symbolize, #time_period_in_words, #truncate
Constructor Details
#initialize(options = {}) ⇒ Notifier
Returns a new instance of Notifier.
37 38 39 40 41 42 43 44 |
# File 'lib/flapjack/gateways/jabber.rb', line 37 def initialize( = {}) @lock = [:lock] @config = [:config] # TODO support for config reloading @queue = Flapjack::RecordQueue.new(@config['queue'] || 'jabber_notifications', Flapjack::Data::Alert) end |
Instance Attribute Details
#siblings ⇒ Object
Returns the value of attribute siblings.
35 36 37 |
# File 'lib/flapjack/gateways/jabber.rb', line 35 def siblings @siblings end |
Instance Method Details
#start ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/flapjack/gateways/jabber.rb', line 46 def start begin Zermelo.redis = Flapjack.redis loop do @lock.synchronize do @queue.foreach {|alert| handle_alert(alert) } end @queue.wait end ensure Flapjack.redis.quit end end |
#stop_type ⇒ Object
62 63 64 |
# File 'lib/flapjack/gateways/jabber.rb', line 62 def stop_type :exception end |