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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f64260a2c43b7cddfce056ed6cff6f59ae352a0
4
- data.tar.gz: b9da4c19970490bdb6cfb343970345332c472373
3
+ metadata.gz: 365d8e6daae12486cdcdba42c0248999f09d2bea
4
+ data.tar.gz: 71b9b267986c6e610a77b2a720033deb07b6a2cd
5
5
  SHA512:
6
- metadata.gz: 6e265a2b60f696f27b9b83f4207203569d3605950a25270e91a5fc4198f027cd36f4d7c886bc7039e705ef75e38502ee8dbdff7320a7e341197de060a0fb4059
7
- data.tar.gz: 63f4b23b96add18afadf522d083ec058cb51830b70ec99ca10222f2ed7f01f693899fba264a02d3859d74f6c3c96e38f202f012419ce33c15d0fbe82d5077a06
6
+ metadata.gz: b6f0b2bd1dfb4fb8edc1b1e68a8377c9fc16e6f009d92a506407c95086a34e6de86ac281aded3e6ab19e5d208dd464ea734e0b5602cfeaa1f617f9c72aa8d563
7
+ data.tar.gz: 52b8288e4b0bcc1642f254211e947dceb9688f16838b2f39ea7bcf85436d91b35432fa0350a7e44a875729ce23f6857161d89063bb04b5cdab28b91ee6593963
@@ -1,9 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2
4
3
  - 2.3
5
4
  - 2.4
6
- - jruby-1.7
7
5
  - jruby-9.1.12.0
8
6
  services:
9
7
  - rabbitmq
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.add_dependency 'bunny', '~> 2.1'
27
27
  end
28
28
 
29
+ spec.add_dependency 'activesupport', '>= 3.2'
29
30
  spec.add_dependency 'multi_op_queue', '>= 0.1.2'
30
31
 
31
32
  spec.add_development_dependency "bundler"
@@ -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
- exchange.publish(payload, publishing_options(route, options))
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
- exchange.publish(message.payload, publishing_options(message.route, message.options || {}))
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
- # This is a really crappy way to wait
41
- sleep 0.01 until queue.size < max_queue_size
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
@@ -1,3 +1,3 @@
1
1
  module ActivePublisher
2
- VERSION = "1.0.0.pre2"
2
+ VERSION = "1.0.0.pre3"
3
3
  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.pre2
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-08-29 00:00:00.000000000 Z
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.5.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