action_subscriber 1.5.1.pre0-java → 1.6.0-java
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 +0 -2
- data/lib/action_subscriber/bunny/subscriber.rb +1 -1
- data/lib/action_subscriber/march_hare/subscriber.rb +1 -1
- data/lib/action_subscriber/route.rb +2 -0
- data/lib/action_subscriber/threadpool.rb +0 -14
- data/lib/action_subscriber/version.rb +1 -1
- data/spec/lib/action_subscriber/router_spec.rb +10 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 959abaf83dc8db177e4f6ce6dab0c7f969602e8a
|
4
|
+
data.tar.gz: 852063b2ecdabd40b76c169a690a172ade234499
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de2df3cc869aaac13b7a44e5949a16f7681659556ae5af9ca2619f8885d8ae2c9c9cc847381fae131ad896f8f914168be628440ece7c3d325323dfd45164e646
|
7
|
+
data.tar.gz: 978f1bc25f6a1db1c516ccb12eca8a8455fb0a7912afe017ce667b52efd8459dc28e5070f3dc06690e9b0c0061d03e7ff966949ebef1fa36229534b2e2c94da7
|
data/bin/action_subscriber
CHANGED
@@ -65,9 +65,7 @@ trap(:USR2) {
|
|
65
65
|
Action Subscriber Stats
|
66
66
|
Pool Size: #{ ::ActionSubscriber.config.threadpool_size }
|
67
67
|
Ready Size: #{ ::ActionSubscriber::Threadpool.ready_size }
|
68
|
-
Jobs Waiting in Queue: #{ ::ActionSubscriber::Threadpool.number_of_jobs_queued }
|
69
68
|
CONFIG
|
70
|
-
ActionSubscriber::Threadpool.print_threadpool_stackraces
|
71
69
|
}
|
72
70
|
|
73
71
|
::ActionSubscriber::CLI.start(ARGV)
|
@@ -37,7 +37,7 @@ module ActionSubscriber
|
|
37
37
|
def auto_subscribe!
|
38
38
|
queues.each do |route, queue|
|
39
39
|
channel = queue.channel
|
40
|
-
channel.prefetch(
|
40
|
+
channel.prefetch(route.prefetch) if route.acknowledgements?
|
41
41
|
consumer = ::Bunny::Consumer.new(channel, queue, channel.generate_consumer_tag, !route.acknowledgements?)
|
42
42
|
consumer.on_delivery do |delivery_info, properties, encoded_payload|
|
43
43
|
::ActiveSupport::Notifications.instrument "received_event.action_subscriber", :payload_size => encoded_payload.bytesize, :queue => queue.name
|
@@ -35,7 +35,7 @@ module ActionSubscriber
|
|
35
35
|
|
36
36
|
def auto_subscribe!
|
37
37
|
queues.each do |route,queue|
|
38
|
-
queue.channel.prefetch =
|
38
|
+
queue.channel.prefetch = route.prefetch if route.acknowledgements?
|
39
39
|
consumer = queue.subscribe(route.queue_subscription_options) do |metadata, encoded_payload|
|
40
40
|
::ActiveSupport::Notifications.instrument "received_event.action_subscriber", :payload_size => encoded_payload.bytesize, :queue => queue.name
|
41
41
|
properties = {
|
@@ -3,6 +3,7 @@ module ActionSubscriber
|
|
3
3
|
attr_reader :acknowledgements,
|
4
4
|
:action,
|
5
5
|
:exchange,
|
6
|
+
:prefetch,
|
6
7
|
:routing_key,
|
7
8
|
:subscriber,
|
8
9
|
:queue
|
@@ -11,6 +12,7 @@ module ActionSubscriber
|
|
11
12
|
@acknowledgements = attributes.fetch(:acknowledgements)
|
12
13
|
@action = attributes.fetch(:action)
|
13
14
|
@exchange = attributes.fetch(:exchange).to_s
|
15
|
+
@prefetch = attributes.fetch(:prefetch) { ::ActionSubscriber.config.prefetch }
|
14
16
|
@routing_key = attributes.fetch(:routing_key)
|
15
17
|
@subscriber = attributes.fetch(:subscriber)
|
16
18
|
@queue = attributes.fetch(:queue)
|
@@ -7,10 +7,6 @@ module ActionSubscriber
|
|
7
7
|
(pool.pool_size == pool.busy_size)
|
8
8
|
end
|
9
9
|
|
10
|
-
def self.number_of_jobs_queued
|
11
|
-
pool.instance_variable_get('@queued_jobs').size
|
12
|
-
end
|
13
|
-
|
14
10
|
def self.perform_async(*args)
|
15
11
|
self.pool.async.perform(*args)
|
16
12
|
end
|
@@ -21,16 +17,6 @@ module ActionSubscriber
|
|
21
17
|
)
|
22
18
|
end
|
23
19
|
|
24
|
-
def self.print_threadpool_stackraces
|
25
|
-
$stderr.puts "ActionSubscriber :: Threadpool stacktraces\n"
|
26
|
-
pool.instance_variable_get('@busy_threads').each do |thread|
|
27
|
-
$stderr.puts <<-THREAD_TRACE
|
28
|
-
#{thread.inspect}:
|
29
|
-
#{thread.backtrace.try(:join, $INPUT_RECORD_SEPARATOR)}"
|
30
|
-
THREAD_TRACE
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
20
|
def self.ready?
|
35
21
|
!busy?
|
36
22
|
end
|
@@ -53,6 +53,16 @@ describe ActionSubscriber::Router do
|
|
53
53
|
expect(routes.first.queue).to eq("alice.fake.foo")
|
54
54
|
end
|
55
55
|
|
56
|
+
it "can specify a prefetch value" do
|
57
|
+
routes = described_class.draw_routes do
|
58
|
+
route FakeSubscriber, :foo, :acknowledgements => true, :prefetch => 10
|
59
|
+
route FakeSubscriber, :bar, :acknowledgements => true
|
60
|
+
end
|
61
|
+
|
62
|
+
expect(routes.first.prefetch).to eq(10)
|
63
|
+
expect(routes.last.prefetch).to eq(::ActionSubscriber.config.prefetch)
|
64
|
+
end
|
65
|
+
|
56
66
|
it "can specify the queue" do
|
57
67
|
routes = described_class.draw_routes do
|
58
68
|
route FakeSubscriber, :foo, :publisher => "russell", :queue => "i-am-your-father"
|
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: 1.
|
4
|
+
version: 1.6.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: 2015-
|
15
|
+
date: 2015-12-04 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
@@ -261,9 +261,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
261
261
|
version: '0'
|
262
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
263
263
|
requirements:
|
264
|
-
- - "
|
264
|
+
- - ">="
|
265
265
|
- !ruby/object:Gem::Version
|
266
|
-
version:
|
266
|
+
version: '0'
|
267
267
|
requirements: []
|
268
268
|
rubyforge_project:
|
269
269
|
rubygems_version: 2.5.0
|