action_subscriber 2.2.1-java → 2.3.0-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: deac02550ec88de73c135a293afb4c1d924e65b8
4
- data.tar.gz: 4ef2de28672b6fdb39a9fc1e380b4bf185469a38
3
+ metadata.gz: 6be4d0f602e06698805dfc7eec7c37bd5332fb63
4
+ data.tar.gz: 75dc85204e6f4c42a65908e51d497417fdbed219
5
5
  SHA512:
6
- metadata.gz: 371863f4e158857e0a1ab8de4349e728246257a14a176e99a2652bcae32f0964536381f390aeace7946c0b57ac549f405de8347126288e57d9ce84ca1337b8e5
7
- data.tar.gz: 926fe3984fd7cb85e4c67a4a4b334ef34214ad979e56fc7996b0d14d593be92753c0c1a3c52c5b7fd3eb71104bc8c23e3920d1b5cf9ebcc56f4c23f3ce55cad2
6
+ metadata.gz: 2356716b4e7e2c6356232ae05efb400d4e60acdc2fbeb2ec0690fbd77b21383440736b16f0dd15d2229ed276fb17344f5ab2368e7184dda4bbabb5afb2c05175
7
+ data.tar.gz: aef2c06b7b620103a501a35dd80ef48669738833c1b27cb229515ef214111ce36617018307a6e7a903ac1f0ab205b95b041565c0a4ff1b490518f7e3f9a142aa
@@ -1,11 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $ACTION_SUBSCRIBER_SERVER_MODE = true
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!
@@ -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
- unless $ACTION_SUBSCRIBER_SERVER_MODE
119
- ::ActiveSupport.run_load_hooks(:action_subscriber, Base)
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
@@ -1,4 +1,5 @@
1
1
  require "yaml"
2
+ require "action_subscriber/uri"
2
3
 
3
4
  module ActionSubscriber
4
5
  class Configuration
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ActionSubscriber
2
- VERSION = "2.2.1"
2
+ VERSION = "2.3.0"
3
3
  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.2.1
4
+ version: 2.3.0
5
5
  platform: java
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-23 00:00:00.000000000 Z
15
+ date: 2016-02-26 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  requirement: !ruby/object:Gem::Requirement
@@ -212,6 +212,7 @@ files:
212
212
  - lib/action_subscriber/middleware/error_handler.rb
213
213
  - lib/action_subscriber/middleware/router.rb
214
214
  - lib/action_subscriber/middleware/runner.rb
215
+ - lib/action_subscriber/preload.rb
215
216
  - lib/action_subscriber/publisher.rb
216
217
  - lib/action_subscriber/publisher/async.rb
217
218
  - lib/action_subscriber/publisher/async/in_memory_adapter.rb