Class: Flapjack::Gateways::AwsSns
- Inherits:
-
Object
- Object
- Flapjack::Gateways::AwsSns
- Includes:
- Utility
- Defined in:
- lib/flapjack/gateways/aws_sns.rb
Constant Summary collapse
- SNS_DEFAULT_REGION_NAME =
'us-east-1'
Instance Attribute Summary collapse
-
#sent ⇒ Object
Returns the value of attribute sent.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ AwsSns
constructor
A new instance of AwsSns.
- #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(opts = {}) ⇒ AwsSns
Returns a new instance of AwsSns.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/flapjack/gateways/aws_sns.rb', line 27 def initialize(opts = {}) @lock = opts[:lock] @config = opts[:config] # TODO support for config reloading @queue = Flapjack::RecordQueue.new(@config['queue'] || 'sns_notifications', Flapjack::Data::Alert) @sent = 0 Flapjack.logger.debug("new sns gateway pikelet with the following options: #{@config.inspect}") end |
Instance Attribute Details
#sent ⇒ Object
Returns the value of attribute sent.
23 24 25 |
# File 'lib/flapjack/gateways/aws_sns.rb', line 23 def sent @sent end |
Instance Method Details
#start ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/flapjack/gateways/aws_sns.rb', line 41 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
57 58 59 |
# File 'lib/flapjack/gateways/aws_sns.rb', line 57 def stop_type :exception end |