action_subscriber 2.2.1 → 2.3.0.pre0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/action_subscriber +5 -15
- data/lib/action_subscriber.rb +7 -25
- data/lib/action_subscriber/configuration.rb +1 -0
- data/lib/action_subscriber/preload.rb +29 -0
- data/lib/action_subscriber/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f487af37045fd05ea5a72d4ccdf49a381fe35959
|
4
|
+
data.tar.gz: 92d840c05ade75979eecc205ce43dea33b0f60d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00e68e86b877228cdf9d05c085ed234c42baa4595570839a50e466b72e6706873011c57e0549888428b4c457b7e5859b7dfa8e32c11dc3d06f58ea59e3674d9a
|
7
|
+
data.tar.gz: 4b1de83156e82701d97202f56dcd30977132e14194c665b702176abe03001d6fa7a408672de4789ee50cfd3799b0ce9592941af8854967c150da528316b69e4e
|
data/bin/action_subscriber
CHANGED
@@ -1,11 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
require 'active_support'
|
6
|
-
require 'active_support/core_ext'
|
7
|
-
require 'thor'
|
8
|
-
require 'action_subscriber'
|
3
|
+
require "action_subscriber/preload"
|
4
|
+
require "thor"
|
9
5
|
|
10
6
|
module ActionSubscriber
|
11
7
|
class CLI < ::Thor
|
@@ -35,17 +31,11 @@ module ActionSubscriber
|
|
35
31
|
|
36
32
|
require options[:app]
|
37
33
|
|
38
|
-
# We run these outside of lib/action_subscriber.rb because we need to load
|
39
|
-
# our railtie (Rails must be defined) before we can run our load hooks.
|
40
|
-
# When requiring action_subscriber as a client, these will be run
|
41
|
-
# automatically.
|
42
|
-
::ActionSubscriber.logger.info "Running load hooks..."
|
43
|
-
|
44
|
-
require "action_subscriber/railtie" if defined?(Rails)
|
45
|
-
::ActiveSupport.run_load_hooks(:action_subscriber, Base)
|
46
|
-
|
47
34
|
::ActionSubscriber.logger.info "Starting server..."
|
48
35
|
|
36
|
+
# Require action_subscriber if the application did not.
|
37
|
+
require "action_subscriber"
|
38
|
+
|
49
39
|
case ::ActionSubscriber.configuration.mode
|
50
40
|
when /pop/i then
|
51
41
|
::ActionSubscriber::Babou.auto_pop!
|
data/lib/action_subscriber.rb
CHANGED
@@ -11,10 +11,13 @@ require "thread"
|
|
11
11
|
|
12
12
|
require "action_subscriber/version"
|
13
13
|
|
14
|
+
# Preload will load configuration and logging. These are the things
|
15
|
+
# that the bin stub need to initialize the configuration before load
|
16
|
+
# hooks are run when the app loads.
|
17
|
+
require "action_subscriber/preload"
|
18
|
+
|
14
19
|
require "action_subscriber/default_routing"
|
15
20
|
require "action_subscriber/dsl"
|
16
|
-
require "action_subscriber/configuration"
|
17
|
-
require "action_subscriber/logging"
|
18
21
|
require "action_subscriber/message_retry"
|
19
22
|
require "action_subscriber/middleware"
|
20
23
|
require "action_subscriber/rabbit_connection"
|
@@ -29,7 +32,6 @@ require "action_subscriber/route_set"
|
|
29
32
|
require "action_subscriber/router"
|
30
33
|
require "action_subscriber/threadpool"
|
31
34
|
require "action_subscriber/base"
|
32
|
-
require "action_subscriber/uri"
|
33
35
|
|
34
36
|
module ActionSubscriber
|
35
37
|
##
|
@@ -51,10 +53,6 @@ module ActionSubscriber
|
|
51
53
|
route_set.auto_subscribe!
|
52
54
|
end
|
53
55
|
|
54
|
-
def self.configuration
|
55
|
-
@configuration ||= ::ActionSubscriber::Configuration.new
|
56
|
-
end
|
57
|
-
|
58
56
|
def self.configure
|
59
57
|
yield(configuration) if block_given?
|
60
58
|
end
|
@@ -68,10 +66,6 @@ module ActionSubscriber
|
|
68
66
|
@draw_routes_block = block
|
69
67
|
end
|
70
68
|
|
71
|
-
def self.logger
|
72
|
-
::ActionSubscriber::Logging.logger
|
73
|
-
end
|
74
|
-
|
75
69
|
def self.print_subscriptions
|
76
70
|
logger.info configuration.inspect
|
77
71
|
route_set.routes.group_by(&:subscriber).each do |subscriber, routes|
|
@@ -107,21 +101,9 @@ module ActionSubscriber
|
|
107
101
|
route_set.cancel_consumers!
|
108
102
|
end
|
109
103
|
|
110
|
-
##
|
111
|
-
# Class aliases
|
112
|
-
#
|
113
|
-
class << self
|
114
|
-
alias_method :config, :configuration
|
115
|
-
end
|
116
|
-
|
117
104
|
# Execution is delayed until after app loads when used with bin/action_subscriber
|
118
|
-
|
119
|
-
|
120
|
-
require "action_subscriber/railtie" if defined?(Rails)
|
121
|
-
end
|
122
|
-
|
123
|
-
# Initialize config object
|
124
|
-
config
|
105
|
+
require "action_subscriber/railtie" if defined?(Rails)
|
106
|
+
::ActiveSupport.run_load_hooks(:action_subscriber, Base)
|
125
107
|
|
126
108
|
# Intialize async publisher adapter
|
127
109
|
::ActionSubscriber::Publisher::Async.publisher_adapter
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "active_support"
|
2
|
+
require "active_support/core_ext"
|
3
|
+
require "middleware"
|
4
|
+
|
5
|
+
require "action_subscriber/configuration"
|
6
|
+
require "action_subscriber/logging"
|
7
|
+
|
8
|
+
module ActionSubscriber
|
9
|
+
##
|
10
|
+
# Public Class Methods
|
11
|
+
#
|
12
|
+
def self.logger
|
13
|
+
::ActionSubscriber::Logging.logger
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.configuration
|
17
|
+
@configuration ||= ::ActionSubscriber::Configuration.new
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# Class aliases
|
22
|
+
#
|
23
|
+
class << self
|
24
|
+
alias_method :config, :configuration
|
25
|
+
end
|
26
|
+
|
27
|
+
# Initialize config object
|
28
|
+
config
|
29
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_subscriber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0.pre0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Stien
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2016-02-
|
15
|
+
date: 2016-02-24 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activesupport
|
@@ -213,6 +213,7 @@ files:
|
|
213
213
|
- lib/action_subscriber/middleware/error_handler.rb
|
214
214
|
- lib/action_subscriber/middleware/router.rb
|
215
215
|
- lib/action_subscriber/middleware/runner.rb
|
216
|
+
- lib/action_subscriber/preload.rb
|
216
217
|
- lib/action_subscriber/publisher.rb
|
217
218
|
- lib/action_subscriber/publisher/async.rb
|
218
219
|
- lib/action_subscriber/publisher/async/in_memory_adapter.rb
|
@@ -271,9 +272,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
271
272
|
version: '0'
|
272
273
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
273
274
|
requirements:
|
274
|
-
- - "
|
275
|
+
- - ">"
|
275
276
|
- !ruby/object:Gem::Version
|
276
|
-
version:
|
277
|
+
version: 1.3.1
|
277
278
|
requirements: []
|
278
279
|
rubyforge_project:
|
279
280
|
rubygems_version: 2.4.5
|