combi 0.0.17 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58781acb66774c82c98e6224c73c7b08c34dcbc1
4
- data.tar.gz: edb565ca843264f3aedd54bf34f166d87f9e39eb
3
+ metadata.gz: 3f249183796133308bcbd8d0b68d616e41843122
4
+ data.tar.gz: 74965fb85fa0badc9c3a105d150b9c9b83d7dd34
5
5
  SHA512:
6
- metadata.gz: 4ce7de6583f49e168fb94f001e41cceb79574ed39699c8871043d620a500458cf3c73c1a329bd0431008a09d3dd349c4a94a7e0683505c5c492557d4f55f9198
7
- data.tar.gz: b4251807c287d559db5c401b35627eea7bfad082e2eb6469301ecd8a9cd2dd5225720efcc81d7924406af97a6d92d5f81c49416ddd58288306f0cb1f09b5da93
6
+ metadata.gz: b99e6f2263b681f20f03b62054447258ec5b2fe99b514c7ec77e13f4160b7b2f6ffdcdd7e28d9a0e5a7f07681e4ca89bb63179fdb8ca4e8270260cf902ec8e8a
7
+ data.tar.gz: c9f21c5147d3afce3afb141e62d70f0c70b3d97498364abcc0719323bcf1a8160dc6a24a21eb8f753d2c6f57c1f4de3bad6666300bb0259f146ffe35e9813d99
@@ -23,6 +23,10 @@ module Combi
23
23
  @ready_defer.callback &block
24
24
  end
25
25
 
26
+ def status
27
+ @amqp_conn && @amqp_conn.status
28
+ end
29
+
26
30
  def log(message)
27
31
  return unless @debug_mode ||= ENV['DEBUG'] == 'true'
28
32
  puts "#{Time.now.to_f} #{self.class.name} #{message}"
@@ -49,17 +53,28 @@ module Combi
49
53
  @channel.auto_recovery = true
50
54
  @exchange = @channel.direct ''
51
55
  after_connect.call
56
+ connection.on_error do |conn, connection_close|
57
+ puts "[amqp connection.close] Reply code = #{connection_close.reply_code}, reply text = #{connection_close.reply_text}"
58
+ if connection_close.reply_code == 320
59
+ puts "[amqp connection.close] Setting up a periodic reconnection timer..."
60
+ reconnect
61
+ end
62
+ end
52
63
  connection.on_tcp_connection_loss do |conn, settings|
53
64
  puts "[ERROR] Connection failed, resetting for reconnect"
54
- @ready_defer = EventMachine::DefaultDeferrable.new
55
- @ready_callbacks.each do |callback|
56
- @ready_defer.callback &callback
57
- end
58
- start
65
+ reconnect
59
66
  end
60
67
  end
61
68
  end
62
69
 
70
+ def reconnect
71
+ @ready_defer = EventMachine::DefaultDeferrable.new
72
+ @ready_callbacks.each do |callback|
73
+ @ready_defer.callback &callback
74
+ end
75
+ start
76
+ end
77
+
63
78
  def disconnect
64
79
  @amqp_conn.close
65
80
  end
@@ -1,3 +1,3 @@
1
1
  module Combi
2
- VERSION = '0.0.17'
2
+ VERSION = '0.0.18'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: combi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - German Del Zotto
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-11 00:00:00.000000000 Z
12
+ date: 2014-06-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: yajl-ruby