class Dynflow::Connectors::Database

Public Class Methods

new(world = nil, polling_interval = nil) click to toggle source
# File lib/dynflow/connectors/database.rb, line 146
def initialize(world = nil, polling_interval = nil)
  polling_interval ||= begin
                         if world && PostgresListerner.notify_supported?(world.persistence.adapter.db)
                           30 # when the notify is supported, we don't need that much polling
                         else
                           1
                         end
                       end
  @core = Core.spawn('connector-database-core', self, polling_interval)
  start_listening(world) if world
end

Public Instance Methods

send(envelope) click to toggle source
# File lib/dynflow/connectors/database.rb, line 170
def send(envelope)
  @core.ask([:handle_envelope, envelope])
end
start_listening(world) click to toggle source
# File lib/dynflow/connectors/database.rb, line 158
def start_listening(world)
  @core.ask([:start_listening, world])
end
stop_listening(_) click to toggle source
# File lib/dynflow/connectors/database.rb, line 166
def stop_listening(_)
  @core.ask(:stop_listening).then { @core.ask(:terminate!) }.wait
end
stop_receiving_new_work(_) click to toggle source
# File lib/dynflow/connectors/database.rb, line 162
def stop_receiving_new_work(_)
  @core.ask(:stop_receiving_new_work).wait
end