Class: LogStash::Outputs::Application_insights::Notification_recovery

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/outputs/application_insights/notification_recovery.rb

Constant Summary collapse

@@instance =
Notification_recovery.new

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNotification_recovery

Returns a new instance of Notification_recovery.



26
27
28
29
30
31
32
33
# File 'lib/logstash/outputs/application_insights/notification_recovery.rb', line 26

def initialize
  configuration = Config.current
  @resurrect_delay = configuration[:resurrect_delay]
  @queue = Queue.new

  @closing = nil
  @thread = nil
end

Class Method Details

.instanceObject



101
102
103
# File 'lib/logstash/outputs/application_insights/notification_recovery.rb', line 101

def self.instance
  @@instance
end

Instance Method Details

#closeObject



56
57
58
59
# File 'lib/logstash/outputs/application_insights/notification_recovery.rb', line 56

def close
  @closing = true
  # @thread.join
end

#enqueue(tuple) ⇒ Object



52
53
54
# File 'lib/logstash/outputs/application_insights/notification_recovery.rb', line 52

def enqueue ( tuple )
  @queue << tuple
end

#recover_later(tuple) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/logstash/outputs/application_insights/notification_recovery.rb', line 40

def recover_later ( tuple )
  @notification_state_on = false
  if stopped?
    @state ||= State.instance
    @state.dec_pending_notifications
    @shutdown ||= Shutdown.instance
    @shutdown.display_msg("!!! notification won't recover in this session due to shutdown")
  else
    @queue << tuple
  end
end

#startObject



35
36
37
38
# File 'lib/logstash/outputs/application_insights/notification_recovery.rb', line 35

def start
  @test_notification = Test_notification.new
  @thread = recovery_thread
end