Class: Actions::Candlepin::SuspendedAction

Inherits:
Object
  • Object
show all
Defined in:
app/lib/actions/candlepin/listen_on_candlepin_events.rb

Instance Method Summary collapse

Constructor Details

#initialize(suspended_action) ⇒ SuspendedAction

Returns a new instance of SuspendedAction.



5
6
7
# File 'app/lib/actions/candlepin/listen_on_candlepin_events.rb', line 5

def initialize(suspended_action)
  @suspended_action = suspended_action
end

Instance Method Details

#notify_connectedObject



17
18
19
# File 'app/lib/actions/candlepin/listen_on_candlepin_events.rb', line 17

def notify_connected
  @suspended_action << Actions::Candlepin::ListenOnCandlepinEvents::Connected
end

#notify_fatal(error) ⇒ Object



13
14
15
# File 'app/lib/actions/candlepin/listen_on_candlepin_events.rb', line 13

def notify_fatal(error)
  @suspended_action << Actions::Candlepin::ListenOnCandlepinEvents::Fatal[error.backtrace && error.backtrace.join('\n'), error.message, error.class.name]
end

#notify_finishedObject



25
26
27
# File 'app/lib/actions/candlepin/listen_on_candlepin_events.rb', line 25

def notify_finished
  @suspended_action << Actions::Candlepin::ListenOnCandlepinEvents::Close
end

#notify_message_received(id, subject, content) ⇒ Object



9
10
11
# File 'app/lib/actions/candlepin/listen_on_candlepin_events.rb', line 9

def notify_message_received(id, subject, content)
  @suspended_action << Actions::Candlepin::ListenOnCandlepinEvents::Event[id, subject, content]
end

#notify_not_connected(message) ⇒ Object



21
22
23
# File 'app/lib/actions/candlepin/listen_on_candlepin_events.rb', line 21

def notify_not_connected(message)
  ForemanTasks.dynflow.world.clock.ping(@suspended_action, 5, Actions::Candlepin::ListenOnCandlepinEvents::Reconnect[message])
end