subserver 0.3.0 → 0.4.4

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: f5671f24e7a384c645c69871b72a24027ec5503e
4
- data.tar.gz: 84e9374f0036d7f63a6724e489333c834e02f51f
3
+ metadata.gz: 73a284fd7153e9a8a35959b770379a35b817b0ef
4
+ data.tar.gz: 5a7322eed0c6f611e9adab75b73cb0be0968d318
5
5
  SHA512:
6
- metadata.gz: 59dac2b3c668911f97a69e9ca722b6a9c38238d520d1d83e3679b41ba4f82f76ad98eb232fd8a831152a71b34d142dce06ec90e03741d1feb1481dfd45518878
7
- data.tar.gz: 8fccb6d65bd86d58d10eaab277e7afe8cc3ae852c3d276bbc5883f2f9d63e570b0e903880c909270cce524ac93dd9f173bd485b90c9da6aa5c211c5536edcb8f
6
+ metadata.gz: 0e300de116cf68d5c281dc1b5269a84fe1a37e5d96fde833f59816bab63cf8baa50a058270bccea51e733970211f4cada96c6dd6758536515fc46b85534c7b7b
7
+ data.tar.gz: 3db36a28c6c1c26a603b954bfb35b6e135d07f8c870aebe41bd15879a9d150c8d0e10b96eb7aec1b2dac7de0f69a57e2c050970ea2f6f4afd0321216e8c4bf22
@@ -1,2 +1,37 @@
1
- # 1.0.0
1
+ # 0.4.4
2
+ - Fixes `Subserver::Testing::Pubsub.topic` missing arguments
3
+
4
+ # 0.4.3
5
+ - Dependacy Updates
6
+ - Ruby >=2.4
7
+ - google-cloud-pubsub ~> 1.7
8
+ - self.auto_subscribe method #25
9
+ - Subserver::Testing::Pubsub::Topic.publish now supports the `attributes` arugment
10
+
11
+ # 0.4.1
12
+ - Fix Listener#process_message error handling
13
+
14
+ # 0.4.0
15
+ - Adds listener_startup lifecycle event
16
+
17
+ # 0.3.0
18
+ - Adds Mocks for testing in applications
19
+
20
+ # 0.2.2
21
+ - Fix issue where multi-subscriber options were getting overridden
22
+
23
+ # 0.2.1
24
+ - Use Rails 5 reloader
25
+ - Fix ActiveRecord connection issues using ConnectionHandler
26
+ - Use Google's Default Enviroment Variables for fallback
27
+
28
+ # 0.2.0
29
+ - Adds PubSub connection testing
30
+ - Fixes a case where subserver would infinitly kill and respawn listeners
31
+ - Cleans up logger code
32
+
33
+ # 0.1.1
34
+ - Fixes connection handling
35
+
36
+ # 0.1.0
2
37
  - Initial Public Release
data/README.md CHANGED
@@ -21,9 +21,9 @@ Subserver is based off of [Sidekiq](https://github.com/mperham/sidekiq). A huge
21
21
 
22
22
  ## Requirements
23
23
  Subserver Supports:
24
- - Ruby >= 2.3.1
24
+ - Ruby >= 2.4.0
25
25
  - All Rails releases >= 4.0
26
- - Google Cloud PubSub Ruby >= 0.31.0
26
+ - Google Cloud PubSub Ruby >= 1.7.0
27
27
 
28
28
  ## Getting Started
29
29
  ### Install
@@ -26,6 +26,7 @@ module Subserver
26
26
  death_handlers: [],
27
27
  lifecycle_events: {
28
28
  startup: [],
29
+ listener_startup: [],
29
30
  quiet: [],
30
31
  shutdown: [],
31
32
  heartbeat: [],
@@ -88,8 +88,8 @@ module Subserver
88
88
  end
89
89
  end
90
90
 
91
- # Before this point, the process is initializing with just the main thread.
92
- # Starting here the process will now have multiple threads running.
91
+ # Until this point, the process is initializing with just the main thread.
92
+ # After this point the process will have multiple threads running.
93
93
  fire_event(:startup, reverse: false, reraise: true)
94
94
 
95
95
  logger.debug { "Middleware: #{Subserver.middleware.map(&:klass).join(', ')}" }
@@ -34,7 +34,7 @@ module Subserver
34
34
  @thread = nil
35
35
  @reloader = Subserver.options[:reloader]
36
36
  @subscriber = subscriber
37
- @subscription = retrive_subscrption
37
+ @subscription = retrieve_subscription
38
38
  @logging = (mgr.options[:message_logger] || Subserver::MessageLogger).new
39
39
  end
40
40
 
@@ -69,7 +69,7 @@ module Subserver
69
69
 
70
70
  private unless $TESTING
71
71
 
72
- def retrive_subscrption
72
+ def retrieve_subscription
73
73
  subscription_name = @subscriber.get_subserver_options[:subscription]
74
74
  subscription = Pubsub.client.subscription subscription_name rescue nil
75
75
  if subscription.nil?
@@ -90,6 +90,8 @@ module Subserver
90
90
 
91
91
  def run
92
92
  begin
93
+ # This begins the listener process in a forked thread
94
+ fire_event(:listener_startup, reverse: false, reraise: true)
93
95
  connect_subscriber
94
96
  @pubsub_listener.start
95
97
  rescue Subserver::Shutdown
@@ -110,9 +112,12 @@ module Subserver
110
112
  rescue Subserver::Shutdown
111
113
  # Reject message if shutdown
112
114
  received_message.reject!
113
- rescue Exception => ex
114
- handle_exception(e, { context: "Exception raised during message processing.", message: received_message })
115
- raise e
115
+ rescue StandardError => error
116
+ handle_exception error, {
117
+ context: 'Exception raised during message processing.',
118
+ message: received_message
119
+ }
120
+ raise
116
121
  end
117
122
  end
118
123
 
@@ -121,4 +126,4 @@ module Subserver
121
126
  end
122
127
 
123
128
  end
124
- end
129
+ end
@@ -35,6 +35,7 @@ module Subserver
35
35
  @listeners = Set.new
36
36
 
37
37
  subscribers.each do |subscriber|
38
+ next if subscriber.auto_subscribe? && !subscriber.auto_subscribe
38
39
  @listeners << Listener.new(self, subscriber)
39
40
  end
40
41
 
@@ -11,6 +11,9 @@ module Subserver
11
11
  end
12
12
 
13
13
  module ClassMethods
14
+ def auto_subscribe?
15
+ respond_to? :auto_subscribe
16
+ end
14
17
 
15
18
  def subserver_options(opts={})
16
19
  self.subserver_options_hash = get_subserver_options.merge(opts)
@@ -3,12 +3,12 @@ module Subserver
3
3
  class Pubsub
4
4
 
5
5
  class Topic
6
- def publish(data)
6
+ def publish(data, attributes = {})
7
7
  true
8
8
  end
9
9
  end
10
10
 
11
- def topic(name)
11
+ def topic(name, project: nil, skip_lookup: nil, async: nil)
12
12
  Topic.new
13
13
  end
14
14
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Subserver
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.4"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subserver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Hill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-10 00:00:00.000000000 Z
11
+ date: 2020-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-pubsub
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.31'
19
+ version: '1.7'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
22
  version: 0.31.0
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '0.31'
29
+ version: '1.7'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 0.31.0
@@ -73,7 +73,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: 2.3.1
76
+ version: 2.4.7
77
77
  required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - ">="
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  version: '0'
82
82
  requirements: []
83
83
  rubyforge_project:
84
- rubygems_version: 2.5.2.3
84
+ rubygems_version: 2.6.14.4
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: Simple background server process for Google Pub/Sub.