amq-client 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -17,4 +17,5 @@ notifications:
17
17
  branches:
18
18
  only:
19
19
  - master
20
+ - 0.9.x-stable
20
21
  - 0.8.x-stable
@@ -151,6 +151,8 @@ module AMQ
151
151
  headers = { :priority => 0, :delivery_mode => 2, :content_type => "application/octet-stream" }.merge(user_headers)
152
152
  @connection.send_frameset(Protocol::Basic::Publish.encode(@channel.id, payload, headers, @name, routing_key, mandatory, immediate, (frame_size || @connection.frame_max)), @channel)
153
153
 
154
+ # publisher confirms support. MK.
155
+ @channel.exec_callback(:after_publish)
154
156
  self
155
157
  end
156
158
 
@@ -57,15 +57,15 @@ module AMQ
57
57
  attr_writer :publisher_index
58
58
 
59
59
  # Publisher index is an index of the last message since
60
- # the confirmations were activated, started with 1. It's
61
- # incremented by 1 after each Basic.Publish starting at 1.
60
+ # the confirmations were activated, started with 0. It's
61
+ # incremented by 1 every time a message is published.
62
62
  # This is done on both client and server, hence this
63
63
  # acknowledged messages can be matched via its delivery-tag.
64
64
  #
65
65
  # @return [Integer] Current publisher index.
66
66
  # @api public
67
67
  def publisher_index
68
- @publisher_index ||= 1
68
+ @publisher_index ||= 0
69
69
  end
70
70
 
71
71
  # Resets publisher index to 0
@@ -81,8 +81,8 @@ module AMQ
81
81
  # can be actually matched.
82
82
  #
83
83
  # @api plugin
84
- def after_publish(*args)
85
- self.publisher_index += 1
84
+ def increment_publisher_index!
85
+ @publisher_index += 1
86
86
  end
87
87
 
88
88
  # Turn on confirmations for this channel and, if given,
@@ -104,7 +104,12 @@ module AMQ
104
104
  end
105
105
 
106
106
  @uses_publisher_confirmations = true
107
+ reset_publisher_index!
108
+
107
109
  self.redefine_callback(:confirm_select, &block) unless nowait
110
+ self.redefine_callback(:after_publish) do
111
+ increment_publisher_index!
112
+ end
108
113
  @connection.send_frame(Protocol::Confirm::Select.encode(@id, nowait))
109
114
 
110
115
  self
@@ -210,23 +215,6 @@ module AMQ
210
215
  end
211
216
  end # self.included(host)
212
217
  end # ChannelMixin
213
-
214
-
215
- module ExchangeMixin
216
- # Publish message and then run #after_publish on channel belonging
217
- # to the exchange. This is used for incrementing the publisher index.
218
- #
219
- # @api public
220
- # @see AMQ::Client::Exchange#publish
221
- # @see AMQ::Client::Extensions::RabbitMQ::Channel#publisher_index
222
- # @return [self] self
223
- def publish(*args, &block)
224
- super(*args)
225
- @channel.after_publish(*args, &block)
226
-
227
- self
228
- end # publish
229
- end # ExchangeMixin
230
218
  end # Confirm
231
219
  end # RabbitMQ
232
220
  end # Extensions
@@ -237,12 +225,6 @@ module AMQ
237
225
  # instead of reckless monkey-patching. MK.
238
226
  include Extensions::RabbitMQ::Confirm::ChannelMixin
239
227
  end # Channel
240
-
241
- class Exchange
242
- # use modules, a native Ruby way of extension of existing classes,
243
- # instead of reckless monkey-patching. MK.
244
- include Extensions::RabbitMQ::Confirm::ExchangeMixin
245
- end # Exchange
246
228
  end # Async
247
229
  end # Client
248
230
  end # AMQ
@@ -2,6 +2,6 @@
2
2
 
3
3
  module AMQ
4
4
  module Client
5
- VERSION = "0.9.0"
5
+ VERSION = "0.9.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amq-client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 59
4
+ hash: 57
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 0
10
- version: 0.9.0
9
+ - 1
10
+ version: 0.9.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jakub Stastny
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2012-01-11 00:00:00 Z
21
+ date: 2012-01-19 00:00:00 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: eventmachine