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
prune_undeliverable_envelopes(world)
click to toggle source
# File lib/dynflow/connectors/database.rb, line 175 def prune_undeliverable_envelopes(world) world.persistence.prune_undeliverable_envelopes end
send(envelope)
click to toggle source
# File lib/dynflow/connectors/database.rb, line 170 def send(envelope) Telemetry.with_instance { |t| t.increment_counter(:dynflow_connector_envelopes, 1, :world => envelope.sender_id, :direction => 'outgoing') } @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(_, timeout = nil)
click to toggle source
# File lib/dynflow/connectors/database.rb, line 166 def stop_listening(_, timeout = nil) @core.ask(:stop_listening).then { @core.ask(:terminate!) }.wait(timeout) end
stop_receiving_new_work(_, timeout = nil)
click to toggle source
# File lib/dynflow/connectors/database.rb, line 162 def stop_receiving_new_work(_, timeout = nil) @core.ask(:stop_receiving_new_work).wait(timeout) end