Class: Dynflow::Connectors::Abstract

Inherits:
Object
  • Object
show all
Includes:
Algebrick::Matching, Algebrick::TypeCheck
Defined in:
lib/dynflow/connectors/abstract.rb

Direct Known Subclasses

Database, Direct

Instance Method Summary collapse

Instance Method Details

#prune_undeliverable_envelopes(world) ⇒ Object

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/dynflow/connectors/abstract.rb', line 29

def prune_undeliverable_envelopes(world)
  raise NotImplementedError
end

#receive(world, envelope) ⇒ Object

we need to pass the world, as the connector can be shared between words: we need to know the one to send the message to



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/dynflow/connectors/abstract.rb', line 35

def receive(world, envelope)
  Type! envelope, Dispatcher::Envelope
  Telemetry.with_instance { |t| t.increment_counter(:dynflow_connector_envelopes, 1, :world => world.id, :direction => 'incoming') }
  match(envelope.message,
    (on Dispatcher::Ping do
       response_envelope = envelope.build_response_envelope(Dispatcher::Pong, world)
       send(response_envelope)
     end),
    (on Dispatcher::Request do
       world.executor_dispatcher.tell([:handle_request, envelope])
     end),
    (on Dispatcher::Response do
       world.client_dispatcher.tell([:dispatch_response, envelope])
     end))
end

#send(envelope) ⇒ Object

Raises:

  • (NotImplementedError)


25
26
27
# File 'lib/dynflow/connectors/abstract.rb', line 25

def send(envelope)
  raise NotImplementedError
end

#start_listening(world) ⇒ Object

Raises:

  • (NotImplementedError)


9
10
11
# File 'lib/dynflow/connectors/abstract.rb', line 9

def start_listening(world)
  raise NotImplementedError
end

#stop_listening(world, timeout = nil) ⇒ Object

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/dynflow/connectors/abstract.rb', line 17

def stop_listening(world, timeout = nil)
  raise NotImplementedError
end

#stop_receiving_new_work(_, timeout = nil) ⇒ Object

Raises:

  • (NotImplementedError)


13
14
15
# File 'lib/dynflow/connectors/abstract.rb', line 13

def stop_receiving_new_work(_, timeout = nil)
  raise NotImplementedError
end

#terminateObject

Raises:

  • (NotImplementedError)


21
22
23
# File 'lib/dynflow/connectors/abstract.rb', line 21

def terminate
  raise NotImplementedError
end