Module: CelluloidIOPGListener

Defined in:
lib/celluloid-io-pg-listener.rb,
lib/celluloid-io-pg-listener/client.rb,
lib/celluloid-io-pg-listener/version.rb,
lib/celluloid-io-pg-listener/examples/client.rb,
lib/celluloid-io-pg-listener/examples/server.rb,
lib/celluloid-io-pg-listener/supervise_signature.rb,
lib/celluloid-io-pg-listener/initialization/async_listener.rb,
lib/celluloid-io-pg-listener/initialization/argument_extraction.rb,
lib/celluloid-io-pg-listener/unlisten_wrappers/with_termination.rb,
lib/celluloid-io-pg-listener/supervision_configuration_signature.rb,
lib/celluloid-io-pg-listener/examples/notify_server_by_inheritance.rb,
lib/celluloid-io-pg-listener/unlisten_wrappers/without_termination.rb,
lib/celluloid-io-pg-listener/examples/listener_client_by_inheritance.rb,
lib/celluloid-io-pg-listener/initialization/client_extracted_signature.rb

Overview

Simple example of a server for sending notifications through postgresql that can be listened for.

Defined Under Namespace

Modules: Client, Examples, Initialization, UnlistenWrappers Classes: SuperviseSignature, SupervisionConfigurationSignature

Constant Summary collapse

UNLISTEN_WRAPPER_TYPE =

Redefining this constant would allow you to set whatever unlisten wrapper you want

{
    unlisten_wrapper_with_termination: "CelluloidIOPGListener::UnlistenWrappers::WithTermination",
    unlisten_wrapper_without_termination: "CelluloidIOPGListener::UnlistenWrappers::WithoutTermination"
}
VERSION =
"0.3.2"

Class Method Summary collapse

Class Method Details

.client(unlisten_wrapper_type = :unlisten_wrapper_with_termination) ⇒ Object

Returns a module Usage:

class MyClient
  include CelluloidIOPGListener.client(:unlisten_wrapper_with_termination) # with no argument this is default
end

For a Client that will be used inside a SupervisorContainer you want to let the Supervisor handle termination.

At least that's my operating hypothesis, if anyone knows better please let me know.

class MyClient
  include CelluloidIOPGListener.client(:unlisten_wrapper_without_termination)
end


29
30
31
32
33
# File 'lib/celluloid-io-pg-listener.rb', line 29

def self.client(unlisten_wrapper_type = :unlisten_wrapper_with_termination)
  wrapper = UNLISTEN_WRAPPER_TYPE[unlisten_wrapper_type]
  puts "unlisten wrapper: #{wrapper},\nunlisten_wrapper_type: #{unlisten_wrapper_type},\ncaller: #{caller.first}"
  Kernel.const_get(wrapper)
end