celluloid-io-pg-listener 0.2.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce318ab56811980419529ad908744fb7fbdb4d98
4
- data.tar.gz: a9c80bee87a9d8590d58a6c74392ddb703ce8741
3
+ metadata.gz: ddc37be5e4eee1abe1413ff3575d48bf00f81b85
4
+ data.tar.gz: 84dc1911a7312843afe56a6aa77e692bc5ccf884
5
5
  SHA512:
6
- metadata.gz: 2cbd4af5d91032b865d410ac8fba9377532f698c548437cf5adbefb9a53c2c493008921fa5df253b45f119d8f33ab004cce387a5d42a35354ef070b81b327c4f
7
- data.tar.gz: b6f55bf9e26766cfa7313f1fd9718be8dc60ed58962c279b153f4a188aa56da3dec76a51903873dabbd5491870c644192573868fa7bf1b650f8787bde36754f7
6
+ metadata.gz: 5a1a385fac178dd4fa8210e309fcdc3905ad7c3e4265c1928a295d216756e79112685223aed0b68d57768605c978a75eef8be783df2a4aafdcde8529e9bd9288
7
+ data.tar.gz: 288ef59b324245f917cd33778f95b3b68e6e8fb027142a75f71b783d60847258070aeb73b4eb9e7880870e96a9cbad10cd1cd9f0419147db03147416d21d28c5
data/.travis.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
+ - 2.0.0
4
5
  - 2.1.5
5
6
  - 2.2.3
6
7
  before_install:
data/README.md CHANGED
@@ -51,6 +51,20 @@ Or install it yourself as:
51
51
 
52
52
  $ gem install celluloid-io-pg-listener
53
53
 
54
+ ## Upgrading 0.2.x to 0.3.x
55
+
56
+ Change:
57
+ ```
58
+ include CelluloidIOPGListener::Client
59
+ ```
60
+ To:
61
+ ```
62
+ include CelluloidIOPGListener.client(:unlisten_wrapper_with_termination)
63
+ ```
64
+ You now have a choice of unlisten wrappers, with or without termination as part of the unlisten.
65
+ The one without terminate is used with you are running a client inside a celluloid supervisor container, which handles termination.
66
+ See `bin/supervisor` and `bin/supervision` in this project for two examples of this.
67
+
54
68
  ## Usage
55
69
 
56
70
  Find a data base that exists that you want to run notifications through. Won't affect anything else in the database,
@@ -61,21 +75,7 @@ In an irb session taking care to:
61
75
  - replace the database names with your own
62
76
  - replace the channel name, if you want, they are arbitrary, and don't need to be "created" in the DB.
63
77
 
64
- First load the examples (they are not loaded by default):
65
- ```ruby
66
- >> require "celluloid-io-pg-listener"
67
- => true
68
- >> require "celluloid-io-pg-listener/examples/client"
69
- => true
70
- >> require "celluloid-io-pg-listener/examples/server"
71
- => true
72
- >> require "celluloid-io-pg-listener/examples/listener_client_by_inheritance"
73
- => true
74
- >> require "celluloid-io-pg-listener/examples/notify_server_by_inheritance"
75
- => true
76
- ```
77
-
78
- Then turn on debug mode to see what is happening:
78
+ Turn on debug mode to see what is happening:
79
79
  ```
80
80
  >> $CELLULOID_DEBUG=true
81
81
  => true
@@ -151,7 +151,7 @@ module CelluloidIOPGListener
151
151
  module Examples
152
152
  class Client
153
153
 
154
- include CelluloidIOPGListener::Client
154
+ include CelluloidIOPGListener.client(:unlisten_wrapper_with_termination)
155
155
 
156
156
  # Defining initialize is optional,
157
157
  # unless you have custom args you need to handle
data/bin/console CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  require "bundler/setup"
4
4
  require "celluloid-io-pg-listener"
5
+ # Load the examples to make it easy to play
6
+ require "celluloid-io-pg-listener/examples/client"
7
+ require "celluloid-io-pg-listener/examples/double_super_example"
8
+ require "celluloid-io-pg-listener/examples/server"
9
+ require "celluloid-io-pg-listener/examples/listener_client_by_inheritance"
10
+ require "celluloid-io-pg-listener/examples/notify_server_by_inheritance"
5
11
 
6
12
  # You can add fixtures and/or initialization code here to make experimenting
7
13
  # with your gem easier. You can also use a different console, if you like.
@@ -0,0 +1,25 @@
1
+ listening_group:
2
+ -
3
+ listener_active: true
4
+ type: CelluloidIOPGListener::Examples::Client
5
+ as: insert_client1
6
+ args:
7
+ dbname: "celluloid_io_pg_listener_test"
8
+ callback_method: insert_callback
9
+ channel: "users_insert"
10
+ -
11
+ listener_active: true
12
+ type: CelluloidIOPGListener::Examples::ListenerClientByInheritance
13
+ as: insert_client2
14
+ args:
15
+ dbname: "celluloid_io_pg_listener_test"
16
+ callback_method: foo_bar
17
+ channel: "users_insert"
18
+ -
19
+ listener_active: true
20
+ type: CelluloidIOPGListener::InsertClient
21
+ as: insert_client3
22
+ args:
23
+ dbname: "celluloid_io_pg_listener_test"
24
+ callback_method: insert_callback
25
+ channel: "users_insert"
data/bin/settings.yml ADDED
@@ -0,0 +1,9 @@
1
+ listening_group:
2
+ -
3
+ listener_active: true
4
+ type: CelluloidIOPGListener::InsertClient
5
+ as: insert_client
6
+ args:
7
+ dbname: "celluloid_io_pg_listener_test"
8
+ callback_method: insert_callback
9
+ channel: "users_insert"
data/bin/supervision ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby
2
+ # Run the supervisor from a command prompt like this:
3
+ #
4
+ # bin/supervision --config bin/settings.yml &
5
+ #
6
+ require "erb"
7
+ require "uri"
8
+ require "yaml"
9
+ require "optparse"
10
+ require "bundler/setup"
11
+ require "celluloid/current"
12
+ require "celluloid/supervision"
13
+ require "celluloid-io-pg-listener"
14
+ require "celluloid-io-pg-listener/supervision_configuration_signature"
15
+
16
+ # These are referenced in bin/settings.yml, so they have to be required:
17
+ require "celluloid-io-pg-listener/examples/client"
18
+ require "celluloid-io-pg-listener/examples/listener_client_by_inheritance"
19
+
20
+ $supervisor_options = {}
21
+ OptionParser.new do |opts|
22
+ opts.banner = "Usage: bin/supervisor [options]"
23
+
24
+ opts.on("-c", "--config FILE", "Path to YAML configuration file") do |file|
25
+ $supervisor_options[:config_path] = file
26
+ end
27
+ opts.on("-d", "--debug", "set $CELLULOID_DEBUG = true") do |file|
28
+ $supervisor_options[:debug] = true
29
+ $CELLULOID_DEBUG = true
30
+ end
31
+ opts.on("-t", "--threaded", "set Celluloid.task_class = Celluloid::Task::Threaded") do |file|
32
+ $supervisor_options[:threaded] = true
33
+ Celluloid.task_class = Celluloid::Task::Threaded
34
+ end
35
+ end.parse!
36
+ puts "$supervisor_options: #{$supervisor_options.inspect}" if $supervisor_options[:debug]
37
+
38
+ module CelluloidIOPGListener
39
+ class InsertClient
40
+ include CelluloidIOPGListener.client(:unlisten_wrapper_without_termination)
41
+ def insert_callback(channel, payload)
42
+ # <-- within the unlisten_wrapper's block if :insert_callback is the callback_method
43
+ debug "#{self.class} channel is #{channel}"
44
+ debug "#{self.class} payload is #{payload}"
45
+ end
46
+ end
47
+ end
48
+
49
+ class ListeningGroup < Celluloid::Supervision::Container
50
+ supervise type: CelluloidIOPGListener::InsertClient, as: :insert_client, args: [{dbname: "celluloid_io_pg_listener_test", channel: "users_insert", callback_method: :insert_callback}]
51
+ end
52
+
53
+ # Alternatively:
54
+ # class ListeningGroup < Celluloid::Supervision::Container
55
+ # signature = CelluloidIOPGListener::SupervisionConfigurationSignature.new(path_to_yaml: $supervisor_options[:config_path]).signature.first
56
+ # supervise **signature
57
+ # end
58
+
59
+ ListeningGroup.run
60
+
data/bin/supervisor CHANGED
@@ -1,16 +1,43 @@
1
1
  #!/usr/bin/env ruby
2
2
  # Run the supervisor from a command prompt like this:
3
3
  #
4
- # bin/supervisor &
4
+ # bin/supervisor --config bin/settings.multiple.yml &
5
5
  #
6
+ require "erb"
7
+ require "uri"
8
+ require "yaml"
9
+ require "optparse"
6
10
  require "bundler/setup"
7
11
  require "celluloid/current"
8
12
  require "celluloid/supervision"
9
13
  require "celluloid-io-pg-listener"
14
+ require "celluloid-io-pg-listener/supervision_configuration_signature"
15
+
16
+ # These are referenced in bin/settings.yml, so they have to be required:
17
+ require "celluloid-io-pg-listener/examples/client"
18
+ require "celluloid-io-pg-listener/examples/listener_client_by_inheritance"
19
+
20
+ $supervisor_options = {}
21
+ OptionParser.new do |opts|
22
+ opts.banner = "Usage: bin/supervisor [options]"
23
+
24
+ opts.on("-c", "--config FILE", "Path to YAML configuration file") do |file|
25
+ $supervisor_options[:config_path] = file
26
+ end
27
+ opts.on("-d", "--debug", "set $CELLULOID_DEBUG = true") do |file|
28
+ $supervisor_options[:debug] = true
29
+ $CELLULOID_DEBUG = true
30
+ end
31
+ opts.on("-t", "--threaded", "set Celluloid.task_class = Celluloid::Task::Threaded") do |file|
32
+ $supervisor_options[:threaded] = true
33
+ Celluloid.task_class = Celluloid::Task::Threaded
34
+ end
35
+ end.parse!
36
+ puts "$supervisor_options: #{$supervisor_options.inspect}" if $supervisor_options[:debug]
10
37
 
11
38
  module CelluloidIOPGListener
12
39
  class InsertClient
13
- include CelluloidIOPGListener::Client
40
+ include CelluloidIOPGListener.client(:unlisten_wrapper_without_termination)
14
41
  def insert_callback(channel, payload)
15
42
  # <-- within the unlisten_wrapper's block if :insert_callback is the callback_method
16
43
  debug "#{self.class} channel is #{channel}"
@@ -18,8 +45,17 @@ module CelluloidIOPGListener
18
45
  end
19
46
  end
20
47
  end
21
- # TODO: Update DB Connection to default to Heroku DB Connection URL, with the salesforce schema, then fallback to celluloid-io-pg-listener_test
48
+
22
49
  class ListeningGroup < Celluloid::Supervision::Container
23
- supervise type: CelluloidIOPGListener::InsertClient, as: :insert_client, args: [{dbname: "celluloid_io_pg_listener_test", channel: "users_insert", callback_method: :insert_callback}]
50
+ signatures = CelluloidIOPGListener::SupervisionConfigurationSignature.new(path_to_yaml: $supervisor_options[:config_path]).signature
51
+ supervise **signatures[0] if signatures[0]
52
+ supervise **signatures[1] if signatures[1]
53
+ supervise **signatures[2] if signatures[2]
24
54
  end
55
+
25
56
  ListeningGroup.run
57
+
58
+ # Not sure why this is not working
59
+ # config_signature = CelluloidIOPGListener::SupervisionConfigurationSignature.new(path_to_yaml: $supervisor_options[:config_path]).signature
60
+ # supervision_config = Celluloid::Supervision::Configuration.define(config_signature)
61
+ # supervision_config.deploy
@@ -4,14 +4,49 @@ require "celluloid/io"
4
4
  require "pg"
5
5
 
6
6
  # Define the namespace this gem uses
7
- module CelluloidIOPGListener; end
7
+ module CelluloidIOPGListener
8
+
9
+ # Redefining this constant would allow you to set whatever unlisten wrapper you want
10
+ UNLISTEN_WRAPPER_TYPE = {
11
+ unlisten_wrapper_with_termination: "CelluloidIOPGListener::UnlistenWrappers::WithTermination",
12
+ unlisten_wrapper_without_termination: "CelluloidIOPGListener::UnlistenWrappers::WithoutTermination"
13
+ }
14
+
15
+ # Returns a module
16
+ # Usage:
17
+ #
18
+ # class MyClient
19
+ # include CelluloidIOPGListener.client(:unlisten_wrapper_with_termination) # with no argument this is default
20
+ # end
21
+ #
22
+ # For a Client that will be used inside a SupervisorContainer you want to let the Supervisor handle termination.
23
+ # At least that's my operating hypothesis, if anyone knows better please let me know.
24
+ #
25
+ # class MyClient
26
+ # include CelluloidIOPGListener.client(:unlisten_wrapper_without_termination)
27
+ # end
28
+ #
29
+ def self.client(unlisten_wrapper_type = :unlisten_wrapper_with_termination)
30
+ wrapper = UNLISTEN_WRAPPER_TYPE[unlisten_wrapper_type]
31
+ puts "unlisten wrapper: #{wrapper},\nunlisten_wrapper_type: #{unlisten_wrapper_type},\ncaller: #{caller.first}"
32
+ Kernel.const_get(wrapper)
33
+ end
34
+
35
+ end
8
36
 
9
37
  require "celluloid-io-pg-listener/initialization/client_extracted_signature"
10
38
  require "celluloid-io-pg-listener/initialization/argument_extraction"
11
39
  require "celluloid-io-pg-listener/initialization/async_listener"
12
40
  require "celluloid-io-pg-listener/client"
41
+ require "celluloid-io-pg-listener/unlisten_wrappers/with_termination"
42
+ require "celluloid-io-pg-listener/unlisten_wrappers/without_termination"
43
+
44
+ # Require in your executable script that runs your supervisor. See bin/supervisor as an example.
45
+ # require "celluloid-io-pg-listener/supervision_configuration_signature"
46
+
13
47
  # Require manually, as in bin/console, if you want to try them out.
14
48
  # require "celluloid-io-pg-listener/examples/client"
49
+ # require "celluloid-io-pg-listener/examples/double_super_example"
15
50
  # require "celluloid-io-pg-listener/examples/server"
16
51
  # require "celluloid-io-pg-listener/examples/listener_client_by_inheritance"
17
52
  # require "celluloid-io-pg-listener/examples/notify_server_by_inheritance"
@@ -25,21 +25,6 @@ module CelluloidIOPGListener
25
25
  def initialize(*args)
26
26
  end
27
27
 
28
- def unlisten_wrapper(channel, payload, &block)
29
- if block_given?
30
- debug "Acting on payload: #{payload} on #{channel}"
31
- instance_eval(&block)
32
- else
33
- info "Not acting on payload: #{payload} on #{channel}"
34
- end
35
- rescue => e
36
- info "#{self.class}##{callback_method} disconnected from #{channel} via #{e.class} #{e.message}"
37
- unlisten(channel)
38
- terminate
39
- # Rescue the error in a daemon-error-reporter to send to Airbrake or other reporting service?
40
- raise
41
- end
42
-
43
28
  def actions
44
29
  @actions ||= {}
45
30
  end
@@ -86,11 +71,5 @@ module CelluloidIOPGListener
86
71
  end
87
72
  end
88
73
 
89
- def unlisten(channel)
90
- # (@listening ||= {})[channel] = false
91
- stop_listening # Not sure if there is a way to stop listening to a single channel without affecting the others.
92
- pg_connection.exec(%[UNLISTEN "#{channel}";])
93
- end
94
-
95
74
  end
96
75
  end
@@ -2,7 +2,7 @@ module CelluloidIOPGListener
2
2
  module Examples
3
3
  class Client
4
4
 
5
- include CelluloidIOPGListener::Client
5
+ include CelluloidIOPGListener.client(:unlisten_wrapper_with_termination)
6
6
 
7
7
  attr_reader :optional_arg
8
8
  # Defining initialize is optional,
@@ -44,7 +44,11 @@ module CelluloidIOPGListener
44
44
  super(channel, payload)
45
45
  else
46
46
  error "LISTENER ERROR: #{payload}"
47
- raise CelluloidIOPGListener::Client::InvalidClient, "#{self.class} does not define a method :#{@callback_method} with arguments (channel, payload)"
47
+ if callback_method == :unlisten_wrapper
48
+ raise CelluloidIOPGListener::Client::InvalidClient, "Please specify a callback_method with signature (channel, payload) to be called on an instance of #{self.class}"
49
+ else
50
+ raise CelluloidIOPGListener::Client::InvalidClient, "#{self.class} does not define a method :#{callback_method} with signature (channel, payload)"
51
+ end
48
52
  end
49
53
  end
50
54
  end
@@ -0,0 +1,86 @@
1
+ module CelluloidIOPGListener
2
+ # Usage:
3
+ #
4
+ # Given a yaml config file of this format:
5
+ #
6
+ # listening_group:
7
+ # -
8
+ # listener_active: <%= ENV["LISTENER_ACTIVE"] || false %>
9
+ # type: HerokuConnectListener::SalesforceAccountClient
10
+ # as: insert_client
11
+ # args:
12
+ # database_url: <%= ENV["DATABASE_URL"] %>
13
+ # redis_url: <%= ENV["REDISTOGO_URL"] || "redis://localhost:6379/" %>
14
+ # callback_method: notify_callback
15
+ # channel: <%= ENV["SCHEMA_NAME"] %>_account_insert
16
+ #
17
+ # Create a Supervision Container such as:
18
+ #
19
+ # class ListeningGroup < Celluloid::Supervision::Container
20
+ # config_path = options[:config_path] || "config/settings.yml"
21
+ # config = YAML::load(ERB.new(File.read(config_path)).result)
22
+ # supervise CelluloidIOPGListener::SuperviseSignature.new(
23
+ # type: config["type"],
24
+ # as: config["as"],
25
+ # args: config["args"]
26
+ # ).signature
27
+ # end
28
+ #
29
+ # ListeningGroup.run
30
+ #
31
+ class SuperviseSignature
32
+ KEYS_WITH_SYMBOL_VALUES = %( callback_method )
33
+ attr_reader :type
34
+ attr_reader :as
35
+ attr_reader :args
36
+
37
+ def initialize(type:, as:, args:)
38
+ @type = Kernel.const_get(type)
39
+ @as = as.to_sym
40
+ if has_database_url?(args)
41
+ args.merge!(convert_database_url_to_hash(db_url: args.delete("database_url")))
42
+ end
43
+ @args = []
44
+ @args << symbolize_keys(args)
45
+ end
46
+
47
+ def signature
48
+ {
49
+ type: type,
50
+ as: as,
51
+ args: args
52
+ }
53
+ end
54
+
55
+ private
56
+
57
+ def symbolize_key(key, value, hash)
58
+ if KEYS_WITH_SYMBOL_VALUES.include?(key)
59
+ hash[key.to_sym] = value.to_sym
60
+ else
61
+ hash[key.to_sym] = value
62
+ end
63
+ end
64
+ def symbolize_keys(args)
65
+ args.inject({}) do |memo, (key, value)|
66
+ symbolize_key(key, value, memo)
67
+ memo
68
+ end
69
+ end
70
+ def has_database_url?(args)
71
+ args.is_a?(Hash) && !args["database_url"].nil?
72
+ end
73
+
74
+ # returns a hash of connection info extracted from the database url (as on Heroku)
75
+ def convert_database_url_to_hash(db_url:)
76
+ uri = URI.parse(db_url)
77
+ connection_info = {}
78
+ connection_info["dbname"] = (uri.path || "").split("/")[1]
79
+ connection_info["user"] = uri.user
80
+ connection_info["password"] = uri.password
81
+ connection_info["host"] = uri.host
82
+ connection_info["port"] = uri.port
83
+ connection_info
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,68 @@
1
+ require "celluloid-io-pg-listener/supervise_signature"
2
+
3
+ module CelluloidIOPGListener
4
+ #
5
+ # Usage:
6
+ #
7
+ # config_path = options[:config_path] || "config/settings.yml"
8
+ # config_signature = CelluloidIOPGListener::SupervisionConfigurationSignature.new(path_to_yaml: config_path).signature
9
+ # supervision_config = Celluloid::Supervision::Configuration.define(*config_signature)
10
+ # supervision_config.deploy
11
+ #
12
+ class SupervisionConfigurationSignature
13
+ include Celluloid::Internals::Logger
14
+
15
+ attr_reader :yaml_config
16
+ attr_reader :supervision_config
17
+
18
+ def initialize(path_to_yaml: nil, yaml_hash: nil)
19
+ @yaml_config = yaml_hash || YAML::load(ERB.new(File.read(path_to_yaml)).result)
20
+ # config may be the whole yaml / hash, or it may be nested.
21
+ # If nested it is value of the key "listening_group".
22
+ @yaml_config = @yaml_config["listening_group"] if @yaml_config["listening_group"]
23
+ unless @yaml_config.nil?
24
+ @yaml_config = @yaml_config.dup # Don't want to mutate anything that was passed in
25
+ @supervision_config = process_yaml_config
26
+ end
27
+ end
28
+
29
+ # Returns an array like this:
30
+ # [
31
+ # {
32
+ # type: MyActor,
33
+ # as: :my_actor,
34
+ # args: []
35
+ # },
36
+ # {
37
+ # type: MyActor,
38
+ # as: :my_actor_with_args,
39
+ # args: [
40
+ # :one_arg,
41
+ # :two_args
42
+ # ]
43
+ # },
44
+ # ]
45
+ def signature
46
+ supervision_config
47
+ end
48
+
49
+ private
50
+
51
+ def process_yaml_config
52
+ yaml_config.inject([]) do |config_array, listener_config|
53
+ debug "listener_config: #{listener_config}"
54
+ if listener_config.delete("listener_active")
55
+ config_array << CelluloidIOPGListener::SuperviseSignature.new(
56
+ type: listener_config["type"],
57
+ as: listener_config["as"],
58
+ args: listener_config["args"]
59
+ ).signature
60
+ info "Listening to channel '#{listener_config["args"]["channel"]}' on database '#{listener_config["args"]["dbname"]}'..."
61
+ else
62
+ info "Listener not active for channel '#{listener_config["args"]["channel"]}' on database '#{listener_config["args"]["dbname"]}'..."
63
+ end
64
+ config_array
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,30 @@
1
+ module CelluloidIOPGListener
2
+ module UnlistenWrappers
3
+ module WithTermination
4
+
5
+ def self.included(base)
6
+ base.send(:include, CelluloidIOPGListener::Client)
7
+ end
8
+
9
+ def unlisten_wrapper(channel, payload, &block)
10
+ if block_given?
11
+ debug "Acting on payload: #{payload} on #{channel}"
12
+ instance_eval(&block)
13
+ else
14
+ info "Not acting on payload: #{payload} on #{channel}"
15
+ end
16
+ rescue => e
17
+ info "#{self.class}##{callback_method} disconnected from #{channel} via #{e.class} #{e.message}"
18
+ unlisten(channel)
19
+ terminate
20
+ raise
21
+ end
22
+
23
+ def unlisten(channel)
24
+ stop_listening
25
+ pg_connection.exec(%[UNLISTEN "#{channel}";])
26
+ end
27
+
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ module CelluloidIOPGListener
2
+ module UnlistenWrappers
3
+ # When running in a Supervision::Container we don't need the terminate.
4
+ module WithoutTermination
5
+
6
+ def self.included(base)
7
+ base.send(:include, CelluloidIOPGListener::Client)
8
+ end
9
+
10
+ def unlisten_wrapper(channel, payload, &block)
11
+ if block_given?
12
+ debug "Acting on payload: #{payload} on #{channel}"
13
+ instance_eval(&block)
14
+ else
15
+ info "Not acting on payload: #{payload} on #{channel}"
16
+ end
17
+ rescue => e
18
+ info "#{self.class}##{callback_method} disconnected from #{channel} via #{e.class} #{e.message}"
19
+ unlisten(channel)
20
+ raise
21
+ end
22
+
23
+ def unlisten(channel)
24
+ stop_listening
25
+ pg_connection.exec(%[UNLISTEN "#{channel}";])
26
+ end
27
+
28
+ end
29
+ end
30
+ end
@@ -1,3 +1,3 @@
1
1
  module CelluloidIOPGListener
2
- VERSION = "0.2.3"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: celluloid-io-pg-listener
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-24 00:00:00.000000000 Z
11
+ date: 2015-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid-io
@@ -183,8 +183,11 @@ files:
183
183
  - README.md
184
184
  - Rakefile
185
185
  - bin/console
186
+ - bin/settings.multiple.yml
187
+ - bin/settings.yml
186
188
  - bin/setup
187
189
  - bin/setup.sql
190
+ - bin/supervision
188
191
  - bin/supervisor
189
192
  - celluloid-io-pg-listener.gemspec
190
193
  - gemfiles/rails_3.2.22.gemfile
@@ -201,6 +204,10 @@ files:
201
204
  - lib/celluloid-io-pg-listener/initialization/argument_extraction.rb
202
205
  - lib/celluloid-io-pg-listener/initialization/async_listener.rb
203
206
  - lib/celluloid-io-pg-listener/initialization/client_extracted_signature.rb
207
+ - lib/celluloid-io-pg-listener/supervise_signature.rb
208
+ - lib/celluloid-io-pg-listener/supervision_configuration_signature.rb
209
+ - lib/celluloid-io-pg-listener/unlisten_wrappers/with_termination.rb
210
+ - lib/celluloid-io-pg-listener/unlisten_wrappers/without_termination.rb
204
211
  - lib/celluloid-io-pg-listener/version.rb
205
212
  homepage: https://github.com/pboling/celluloid-io-pg-listener
206
213
  licenses: