amq-client 1.0.0.pre1 → 1.0.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
data/amq-client.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
 
21
21
  # Dependencies
22
22
  s.add_dependency "eventmachine"
23
- s.add_dependency "amq-protocol", ">= 0.9.0"
23
+ s.add_dependency "amq-protocol", ">= 0.9.4"
24
24
 
25
25
 
26
26
  # RubyForge
@@ -274,9 +274,15 @@ module AMQ
274
274
  # @return [Fixnum] Heartbeat interval this client uses, in seconds.
275
275
  # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.6)
276
276
  def heartbeat_interval
277
- @settings[:heartbeat] || @settings[:heartbeat_interval] || 3
277
+ @settings[:heartbeat] || @settings[:heartbeat_interval] || 0
278
278
  end # heartbeat_interval
279
279
 
280
+ # Returns true if heartbeats are enabled (heartbeat interval is greater than 0)
281
+ # @return [Boolean]
282
+ def heartbeats_enabled?
283
+ self.heartbeat_interval > 0
284
+ end
285
+
280
286
 
281
287
  # vhost this connection uses. Default is "/", a historically estabilished convention
282
288
  # of RabbitMQ and amqp gem.
@@ -529,10 +535,16 @@ module AMQ
529
535
  # @param [Array<AMQ::Protocol::Frame>] frames
530
536
  # @api plugin
531
537
  def receive_frameset(frames)
538
+ if self.heartbeats_enabled?
539
+ # treat incoming traffic as heartbeats.
540
+ # this operation is pretty expensive under heavy traffic but heartbeats can be disabled
541
+ # (and are also disabled by default). MK.
542
+ @last_server_heartbeat = Time.now
543
+ end
532
544
  frame = frames.first
533
545
 
534
- if Protocol::HeartbeatFrame === frame
535
- @last_server_heartbeat = Time.now
546
+ if AMQ::Protocol::HeartbeatFrame === frame
547
+ # no-op
536
548
  else
537
549
  if callable = AMQ::Client::HandlersRegistry.find(frame.method_class)
538
550
  f = frames.shift
@@ -173,9 +173,7 @@ module AMQ
173
173
  self.reset
174
174
  self.set_pending_connect_timeout((@settings[:timeout] || 3).to_f) unless defined?(JRUBY_VERSION)
175
175
 
176
- if self.heartbeat_interval > 0
177
- self.initialize_heartbeat_sender
178
- end
176
+ self.initialize_heartbeat_sender if self.heartbeats_enabled?
179
177
  end # initialize(*args)
180
178
 
181
179
 
@@ -40,7 +40,8 @@ module AMQ
40
40
  # if you want to load broker-specific extensions
41
41
  :broker => nil,
42
42
 
43
- :frame_max => 131072
43
+ :frame_max => 131072,
44
+ :heartbeat => 0
44
45
  }
45
46
  end
46
47
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module AMQ
4
4
  module Client
5
- VERSION = "1.0.0.pre1"
5
+ VERSION = "1.0.0.pre2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amq-client
3
3
  version: !ruby/object:Gem::Version
4
- hash: -2724271480
4
+ hash: -1880058884
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
10
  - pre
11
- - 1
12
- version: 1.0.0.pre1
11
+ - 2
12
+ version: 1.0.0.pre2
13
13
  platform: ruby
14
14
  authors:
15
15
  - Jakub Stastny
@@ -20,7 +20,7 @@ autorequire:
20
20
  bindir: bin
21
21
  cert_chain: []
22
22
 
23
- date: 2012-06-22 00:00:00 Z
23
+ date: 2012-07-03 00:00:00 Z
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: eventmachine
@@ -44,12 +44,12 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- hash: 59
47
+ hash: 51
48
48
  segments:
49
49
  - 0
50
50
  - 9
51
- - 0
52
- version: 0.9.0
51
+ - 4
52
+ version: 0.9.4
53
53
  type: :runtime
54
54
  version_requirements: *id002
55
55
  description: amq-client is a fully-featured, low-level AMQP 0.9.1 client with pluggable networking I/O adapters (EventMachine, cool.io, Eventpanda and so on) and supposed to back more opinionated AMQP clients (such as amqp gem) or be used directly in cases when access to more advanced AMQP 0.9.1 features is more important that convenient APIs
@@ -256,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
256
  requirements: []
257
257
 
258
258
  rubyforge_project: amq-client
259
- rubygems_version: 1.8.15
259
+ rubygems_version: 1.8.24
260
260
  signing_key:
261
261
  specification_version: 3
262
262
  summary: amq-client is a fully-featured, low-level AMQP 0.9.1 client