active_publisher 1.0.0.pre2 → 1.0.0.pre3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -2
- data/active_publisher.gemspec +1 -0
- data/lib/active_publisher.rb +7 -2
- data/lib/active_publisher/async/in_memory_adapter/async_queue.rb +9 -2
- data/lib/active_publisher/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 365d8e6daae12486cdcdba42c0248999f09d2bea
|
4
|
+
data.tar.gz: 71b9b267986c6e610a77b2a720033deb07b6a2cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6f0b2bd1dfb4fb8edc1b1e68a8377c9fc16e6f009d92a506407c95086a34e6de86ac281aded3e6ab19e5d208dd464ea734e0b5602cfeaa1f617f9c72aa8d563
|
7
|
+
data.tar.gz: 52b8288e4b0bcc1642f254211e947dceb9688f16838b2f39ea7bcf85436d91b35432fa0350a7e44a875729ce23f6857161d89063bb04b5cdab28b91ee6593963
|
data/.travis.yml
CHANGED
data/active_publisher.gemspec
CHANGED
data/lib/active_publisher.rb
CHANGED
@@ -3,6 +3,7 @@ if ::RUBY_PLATFORM == "java"
|
|
3
3
|
else
|
4
4
|
require "bunny"
|
5
5
|
end
|
6
|
+
require "active_support"
|
6
7
|
require "thread"
|
7
8
|
|
8
9
|
require "active_publisher/logging"
|
@@ -34,7 +35,9 @@ module ActivePublisher
|
|
34
35
|
# @param [Hash] options hash to set message parameters (e.g. headers)
|
35
36
|
def self.publish(route, payload, exchange_name, options = {})
|
36
37
|
with_exchange(exchange_name) do |exchange|
|
37
|
-
|
38
|
+
::ActiveSupport::Notifications.instrument "message_published.active_publisher" do
|
39
|
+
exchange.publish(payload, publishing_options(route, options))
|
40
|
+
end
|
38
41
|
end
|
39
42
|
end
|
40
43
|
|
@@ -48,7 +51,9 @@ module ActivePublisher
|
|
48
51
|
fail ActivePublisher::ExchangeMismatchError, "bulk publish messages must match publish_all exchange_name" if message.exchange_name != exchange_name
|
49
52
|
|
50
53
|
begin
|
51
|
-
|
54
|
+
::ActiveSupport::Notifications.instrument "message_published.active_publisher" do
|
55
|
+
exchange.publish(message.payload, publishing_options(message.route, message.options || {}))
|
56
|
+
end
|
52
57
|
rescue
|
53
58
|
messages << message
|
54
59
|
raise
|
@@ -33,12 +33,16 @@ module ActivePublisher
|
|
33
33
|
if queue.size >= max_queue_size
|
34
34
|
case back_pressure_strategy
|
35
35
|
when :drop
|
36
|
+
::ActiveSupport::Notifications.instrument "message_dropped.active_publisher"
|
36
37
|
return
|
37
38
|
when :raise
|
39
|
+
::ActiveSupport::Notifications.instrument "message_dropped.active_publisher"
|
38
40
|
fail ::ActivePublisher::Async::InMemoryAdapter::UnableToPersistMessageError, "Queue is full, messages will be dropped."
|
39
41
|
when :wait
|
40
|
-
|
41
|
-
|
42
|
+
::ActiveSupport::Notifications.instrument "wait_for_async_queue.active_publisher" do
|
43
|
+
# This is a really crappy way to wait
|
44
|
+
sleep 0.01 until queue.size < max_queue_size
|
45
|
+
end
|
42
46
|
end
|
43
47
|
end
|
44
48
|
|
@@ -63,6 +67,9 @@ module ActivePublisher
|
|
63
67
|
@consumer = ::ActivePublisher::Async::InMemoryAdapter::ConsumerThread.new(queue)
|
64
68
|
end
|
65
69
|
|
70
|
+
# Notify the current queue size.
|
71
|
+
::ActiveSupport::Notifications.instrument "async_queue_size.active_publisher", queue.size
|
72
|
+
|
66
73
|
# Pause before checking the consumer again.
|
67
74
|
sleep supervisor_interval
|
68
75
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_publisher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.pre3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Stien
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: exe
|
14
14
|
cert_chain: []
|
15
|
-
date: 2017-
|
15
|
+
date: 2017-09-01 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: bunny
|
@@ -28,6 +28,20 @@ dependencies:
|
|
28
28
|
- - "~>"
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '2.1'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: activesupport
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3.2'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '3.2'
|
31
45
|
- !ruby/object:Gem::Dependency
|
32
46
|
name: multi_op_queue
|
33
47
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
164
|
version: 1.3.1
|
151
165
|
requirements: []
|
152
166
|
rubyforge_project:
|
153
|
-
rubygems_version: 2.
|
167
|
+
rubygems_version: 2.6.13
|
154
168
|
signing_key:
|
155
169
|
specification_version: 4
|
156
170
|
summary: Aims to make publishing work across MRI and jRuby painless and add some nice
|