stomp 1.3.0 → 1.3.1

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzAwZGNiZmI2NzJkZWZkNWNlZWY4NDZiZTU3NjFiNzhkNjRmNDkyOA==
4
+ NDk2MTQ0MmYyZmUzZDhkYTRhZDQ5MTg1Y2EwZTk2ZDQzODNkYjIxMg==
5
5
  data.tar.gz: !binary |-
6
- MmUyNDgwOWVmOWYxMmRmMjIxMTZlZDQxMmI3ODcxMTk5ODRlNzQyNA==
6
+ ZjFjMzc4ZGNhMWEzY2ZmZDJhODk5MmZhM2FhNzZmMzY0MWUyNzJhMg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NjA2MDRjODc2MjEwODVjNTFjZDRkYzFmZDdhNGVmN2FiN2NmYjNkOTE2YmIz
10
- YzExNWI3OWE1ZjEzMDMwNmJiNDAxYmYxOGFiMjhiYjEzZGY4YWMxMzc5NzI1
11
- NTUyNjgwYmQwYjQyNzlkNjlkYmM4M2VkN2QwZjYwZDUyMTU4NWI=
9
+ OTI5ZjFlNzFjMzFhNWUyZDA2YjRlYmFiZjVlNmE4ZGI4YWExZjgyZGMyOTgw
10
+ ZTY3N2ZkY2EzNmRmM2ZjYWZmYmQyMGZjZjIxMTkyNTBmY2IyZGI1NWVjYWZi
11
+ YmNjNzdiZTU2NzRmMTFiZmIyMzYyYjI4ZDZkZGQ2YzA1OGNmZDM=
12
12
  data.tar.gz: !binary |-
13
- OTNmMjliOTM4NmI3NmRjOTllNzc0NWE2MDM2YTZlZTg2ZTk1YTBlMDEwMjRk
14
- YTk2MGM3ZDFkNzUxZDc3OGI4ZmRkNWI5OWJhZTdjOGVlMzY0MmU3YzljMDU5
15
- NWMxZTkwMTk4ZDAwODA2ZDA5YTZiZmQ5N2Q1M2JhMDJkNjZhMmY=
13
+ NmNmZWRjMGYyYWYzNTI3NTA4ZDEwMjQxYTdlYWExZDQ5ZTBkOWIzYmYzMGUz
14
+ NDg3YjY5OTE5MzM4NWQ3OTVhZDcwZGUwZGVhYTFmNjJjY2ZjMTA2NjgyZDBi
15
+ NzEzNTBjYTA5NzY4ZTc1MmRlN2Y5MzE3ZTcwNTdkNjFiNzU0OGI=
@@ -1,3 +1,7 @@
1
+ == 1.3.1 20131002
2
+
3
+ * Method calls to the logger object should check for that method first (#83)
4
+
1
5
  == 1.3.0 20130930
2
6
 
3
7
  * ERROR frames now raise an exception in the Stomp::Client thread(#73, #81)
@@ -12,6 +12,7 @@ An implementation of the Stomp protocol for Ruby. See:
12
12
 
13
13
  See _CHANGELOG.rdoc_ for details.
14
14
 
15
+ * Gem version 1.3.1. Bugfix for logging.
15
16
  * Gem version 1.3.0. Added ERROR frame raising as exception, added anonymous connections, miscellaneous other fixes.
16
17
  * Gem version 1.2.16. Fixed Stomp::Client to expose its connection's host parameters.
17
18
  * Gem version 1.2.15. Timeout cleanup, added license info to gemspec.
@@ -65,6 +66,7 @@ See _CHANGELOG.rdoc_ for details.
65
66
  # correct for your environment, expect unnecessary fail overs
66
67
  :connread_timeout => 0, # Timeout during CONNECT for read of CONNECTED/ERROR, secs
67
68
  :tcp_nodelay => true, # Turns on the TCP_NODELAY socket option; disables Nagle's algorithm
69
+ :start_timeout => 10, # Timeout around initialization
68
70
  }
69
71
 
70
72
  # for client
@@ -100,7 +100,10 @@ module Stomp
100
100
  sleep(slt)
101
101
  next unless @socket # nil under some circumstances ??
102
102
  curt = Time.now.to_f
103
- @logger.on_hbfire(log_params, "send_fire", :curt => curt, :last_sleep => slt)
103
+
104
+ if @logger && @logger.respond_to?(:on_hbfire)
105
+ @logger.on_hbfire(log_params, "send_fire", :curt => curt, :last_sleep => slt)
106
+ end
104
107
 
105
108
  delta = curt - @ls
106
109
  # Be tolerant (minus), and always do this the first time through.
@@ -108,9 +111,11 @@ module Stomp
108
111
  compval = (@hbsend_interval - (@hbsend_interval/5.0)) / 1000000.0
109
112
  if delta > compval || first_time
110
113
  first_time = false
111
- @logger.on_hbfire(log_params, "send_heartbeat", :last_sleep => slt,
112
- :curt => curt, :last_send => @ls, :delta => delta,
113
- :compval => compval)
114
+ if @logger && @logger.respond_to?(:on_hbfire)
115
+ @logger.on_hbfire(log_params, "send_heartbeat", :last_sleep => slt,
116
+ :curt => curt, :last_send => @ls, :delta => delta,
117
+ :compval => compval)
118
+ end
114
119
  # Send a heartbeat
115
120
  @transmit_semaphore.synchronize do
116
121
  begin
@@ -121,8 +126,10 @@ module Stomp
121
126
  @hbsend_count += 1
122
127
  rescue Exception => sendex
123
128
  @hb_sent = false # Set the warning flag
124
- @logger.on_hbwrite_fail(log_params, {"ticker_interval" => sleeptime,
125
- "exception" => sendex})
129
+ if @logger && @logger.respond_to?(:on_hbwrite_fail)
130
+ @logger.on_hbwrite_fail(log_params, {"ticker_interval" => sleeptime,
131
+ "exception" => sendex})
132
+ end
126
133
  if @hbser
127
134
  raise # Re-raise if user requested this, otherwise ignore
128
135
  end
@@ -160,12 +167,16 @@ module Stomp
160
167
  next unless @socket # nil under some circumstances ??
161
168
  rdrdy = _is_ready?(@socket)
162
169
  curt = Time.now.to_f
163
- @logger.on_hbfire(log_params, "receive_fire", :curt => curt)
170
+ if @logger && @logger.respond_to?(:on_hbfire)
171
+ @logger.on_hbfire(log_params, "receive_fire", :curt => curt)
172
+ end
164
173
  #
165
174
  begin
166
175
  delta = curt - @lr
167
176
  if delta > sleeptime
168
- @logger.on_hbfire(log_params, "receive_heartbeat", {})
177
+ if @logger && @logger.respond_to?(:on_hbfire)
178
+ @logger.on_hbfire(log_params, "receive_heartbeat", {})
179
+ end
169
180
  # Client code could be off doing something else (that is, no reading of
170
181
  # the socket has been requested by the caller). Try to handle that case.
171
182
  lock = @read_semaphore.try_lock
@@ -192,20 +203,24 @@ module Stomp
192
203
  @read_semaphore.unlock # Release read lock
193
204
  @hb_received = false
194
205
  read_fail_count += 1
195
- @logger.on_hbread_fail(log_params, {"ticker_interval" => sleeptime,
196
- "read_fail_count" => read_fail_count,
197
- "lock_fail" => false,
198
- "lock_fail_count" => lock_fail_count})
206
+ if @logger && @logger.respond_to?(:on_hbread_fail)
207
+ @logger.on_hbread_fail(log_params, {"ticker_interval" => sleeptime,
208
+ "read_fail_count" => read_fail_count,
209
+ "lock_fail" => false,
210
+ "lock_fail_count" => lock_fail_count})
211
+ end
199
212
  end
200
213
  else # try_lock failed
201
214
  # Shrug. Could not get lock. Client must be actually be reading.
202
215
  @hb_received = false
203
216
  # But notify caller if possible
204
217
  lock_fail_count += 1
205
- @logger.on_hbread_fail(log_params, {"ticker_interval" => sleeptime,
206
- "read_fail_count" => read_fail_count,
207
- "lock_fail" => true,
208
- "lock_fail_count" => lock_fail_count})
218
+ if @logger && @logger.respond_to?(:on_hbread_fail)
219
+ @logger.on_hbread_fail(log_params, {"ticker_interval" => sleeptime,
220
+ "read_fail_count" => read_fail_count,
221
+ "lock_fail" => true,
222
+ "lock_fail_count" => lock_fail_count})
223
+ end
209
224
  end # of the try_lock
210
225
 
211
226
  else # delta <= sleeptime
@@ -214,10 +229,12 @@ module Stomp
214
229
  lock_fail_count = 0 # reset
215
230
  end # of the if delta > sleeptime
216
231
  rescue Exception => recvex
217
- @logger.on_hbread_fail(log_params, {"ticker_interval" => sleeptime,
218
- "exception" => recvex,
219
- "read_fail_count" => read_fail_count,
220
- "lock_fail_count" => lock_fail_count})
232
+ if @logger && @logger.respond_to?(:on_hbread_fail)
233
+ @logger.on_hbread_fail(log_params, {"ticker_interval" => sleeptime,
234
+ "exception" => recvex,
235
+ "read_fail_count" => read_fail_count,
236
+ "lock_fail_count" => lock_fail_count})
237
+ end
221
238
  fail_hard = true
222
239
  end
223
240
  # Do we want to attempt a retry?
@@ -130,8 +130,11 @@ module Stomp
130
130
  @failure = $!
131
131
  raise unless @reliable
132
132
  errstr = "transmit to #{@host} failed: #{$!}\n"
133
- @logger.on_miscerr(log_params, "es_trans: " + errstr)
134
- $stderr.print errstr
133
+ if @logger && @logger.respond_to?(:on_miscerr)
134
+ @logger.on_miscerr(log_params, "es_trans: " + errstr)
135
+ else
136
+ $stderr.print errstr
137
+ end
135
138
  # !!! This loop initiates a re-connect !!!
136
139
  _reconn_prep()
137
140
  end
@@ -198,7 +201,9 @@ module Stomp
198
201
  def open_tcp_socket()
199
202
  tcp_socket = nil
200
203
 
201
- @logger.on_connecting(log_params)
204
+ if @logger && @logger.respond_to?(:on_connecting)
205
+ @logger.on_connecting(log_params)
206
+ end
202
207
 
203
208
  Timeout::timeout(@connect_timeout, Stomp::Error::SocketOpenTimeout) do
204
209
  tcp_socket = TCPSocket.open(@host, @port)
@@ -276,7 +281,9 @@ module Stomp
276
281
 
277
282
  #
278
283
  ssl = nil
279
- @logger.on_ssl_connecting(log_params)
284
+ if @logger && @logger.respond_to?(:on_ssl_connecting)
285
+ @logger.on_ssl_connecting(log_params)
286
+ end
280
287
 
281
288
  Timeout::timeout(@connect_timeout, Stomp::Error::SocketOpenTimeout) do
282
289
  tcp_socket = TCPSocket.open(@host, @port)
@@ -297,12 +304,16 @@ module Stomp
297
304
  end
298
305
  @ssl.peer_cert = ssl.peer_cert
299
306
  end
300
- @logger.on_ssl_connected(log_params)
307
+ if @logger && @logger.respond_to?(:on_ssl_connected)
308
+ @logger.on_ssl_connected(log_params)
309
+ end
301
310
  ssl
302
311
  rescue Exception => ex
303
- lp = log_params.clone
304
- lp[:ssl_exception] = ex
305
- @logger.on_ssl_connectfail(lp)
312
+ if @logger && @logger.respond_to?(:on_ssl_connectfail)
313
+ lp = log_params.clone
314
+ lp[:ssl_exception] = ex
315
+ @logger.on_ssl_connectfail(lp)
316
+ end
306
317
  #
307
318
  raise # Reraise
308
319
  end
@@ -116,7 +116,9 @@ module Stomp
116
116
  used_socket = open_socket() # sets @closed = false if OK
117
117
  # Open is complete
118
118
  connect(used_socket)
119
- @logger.on_connected(log_params)
119
+ if @logger && @logger.respond_to?(:on_connected)
120
+ @logger.on_connected(log_params)
121
+ end
120
122
  @connection_attempts = 0
121
123
  rescue
122
124
  @failure = $!
@@ -130,13 +132,16 @@ module Stomp
130
132
  # b) should never be retried
131
133
  raise if @failure.is_a?(Stomp::Error::ProtocolError11p)
132
134
 
133
- # on_connectfail may raise
134
- begin
135
- @logger.on_connectfail(log_params)
136
- rescue Exception => aex
137
- raise if aex.is_a?(Stomp::Error::LoggerConnectionError)
135
+ if @logger && @logger.respond_to?(:on_connectfail)
136
+ # on_connectfail may raise
137
+ begin
138
+ @logger.on_connectfail(log_params)
139
+ rescue Exception => aex
140
+ raise if aex.is_a?(Stomp::Error::LoggerConnectionError)
141
+ end
142
+ else
143
+ $stderr.print "connect to #{@host} failed: #{$!} will retry(##{@connection_attempts}) in #{@reconnect_delay}\n"
138
144
  end
139
- $stderr.print "connect to #{@host} failed: #{$!} will retry(##{@connection_attempts}) in #{@reconnect_delay}\n"
140
145
  raise Stomp::Error::MaxReconnectAttempts if max_reconnect_attempts?
141
146
 
142
147
  sleep(@reconnect_delay)
@@ -232,8 +237,11 @@ module Stomp
232
237
  @failure = $!
233
238
  raise unless @reliable
234
239
  errstr = "receive failed: #{$!}"
235
- @logger.on_miscerr(log_params, "es_oldrecv: " + errstr)
236
- $stderr.print errstr
240
+ if @logger && @logger.respond_to?(:on_miscerr)
241
+ @logger.on_miscerr(log_params, "es_oldrecv: " + errstr)
242
+ else
243
+ $stderr.print errstr
244
+ end
237
245
 
238
246
  # !!! This initiates a re-connect !!!
239
247
  _reconn_prep()
@@ -6,7 +6,7 @@ module Stomp
6
6
  module Version #:nodoc: all
7
7
  MAJOR = 1
8
8
  MINOR = 3
9
- PATCH = 0
9
+ PATCH = 1
10
10
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
11
11
  end
12
12
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "stomp"
8
- s.version = "1.3.0"
8
+ s.version = "1.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian McCallister", "Marius Mathiesen", "Thiago Morello", "Guy M. Allard"]
12
- s.date = "2013-09-30"
12
+ s.date = "2013-10-02"
13
13
  s.description = "Ruby client for the Stomp messaging protocol. Note that this gem is no longer supported on rubyforge."
14
14
  s.email = ["brianm@apache.org", "marius@stones.com", "morellon@gmail.com", "allard.guy.m@gmail.com"]
15
15
  s.executables = ["catstomp", "stompcat"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stomp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian McCallister
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-09-30 00:00:00.000000000 Z
14
+ date: 2013-10-02 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rspec