tdl-client-ruby 0.19.2 → 0.19.3

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: 99214da19f3a78b06525a6e190e572f5eb80f7f5
4
- data.tar.gz: fb6aeae12794813869d77f463982f36503625d27
3
+ metadata.gz: bfea2b9c8522c632c1575cb265fa63878c43bc58
4
+ data.tar.gz: dadbb03629370a64ba8a4a4276f89e02226989ba
5
5
  SHA512:
6
- metadata.gz: 60c572d16cbadaf8e6a06ab0874e03a2c8b076182d5126a3e3fa0758105befecb101d9f44f1090def6bd1a4eca91ebd7441bd3f8f399b3a1f495292b14372627
7
- data.tar.gz: bdb85f0924d671be7289474b082eccd4ca8473564621f4979b3eb288726dd31a321a14331c82a57a99919f9953601d688bda3f850c61068fbf36e39987f43319
6
+ metadata.gz: aeb4e17b7745cacf524813ffb60764420371da73130b379571bc21e4883392694a3bd9a00494207e9323aadde3b2775c9a8bc54faa281d1a7dea61b9b19ed609
7
+ data.tar.gz: aa0d593c0048d922993c6296ca1c7c306a8d3eb3bf827ca0c4201414cb290913e26c389501bbd64093e945166368ff973f1701840adb97c83ce653cec0a9ddd0
data/lib/tdl/client.rb CHANGED
@@ -33,7 +33,6 @@ module TDL
33
33
  @logger.info 'Waiting for requests.'
34
34
  remote_broker.join
35
35
  @logger.info 'Stopping client.'
36
- remote_broker.close unless remote_broker.closed?
37
36
 
38
37
  rescue Exception => e
39
38
  # raise e if ENV['TDL_ENV'] == 'test'
@@ -1,4 +1,4 @@
1
1
  module TDL
2
- PREVIOUS_VERSION = '0.19.1'
2
+ PREVIOUS_VERSION = '0.19.2'
3
3
  # the current MAJOR.MINOR version is dynamically computed from the version of the Spec
4
4
  end
@@ -6,15 +6,15 @@ class ThreadTimer
6
6
  @timer_thread = nil
7
7
  end
8
8
 
9
- def start_timer
9
+ def start
10
10
  @continue = true
11
11
  @timer_thread = Thread.new { start_timeout }
12
12
  end
13
13
 
14
- def stop_timer
15
- @continue = false
14
+ def stop
16
15
  @timer_thread.terminate unless @timer_thread.nil?
17
16
  @timer_thread = nil
17
+ @continue = false
18
18
  end
19
19
 
20
20
  private
@@ -5,31 +5,34 @@ module TDL
5
5
  def initialize(hostname, port, unique_id, request_timeout_millis)
6
6
  @stomp_client = Stomp::Client.new('', '', hostname, port)
7
7
  @unique_id = unique_id
8
+ @request_queue = "/queue/#{@unique_id}.req"
9
+ @response_queue = "/queue/#{@unique_id}.resp"
8
10
  @serialization_provider = JSONRPCSerializationProvider.new
9
- @timer_thread = ThreadTimer.new(request_timeout_millis, lambda = ->() { close })
11
+ @timer = ThreadTimer.new(request_timeout_millis, lambda = ->() { close unless closed? })
12
+ @timer.start
10
13
  end
11
14
 
12
15
  def subscribe(handling_strategy)
13
- @stomp_client.subscribe("/queue/#{@unique_id}.req", {:ack => 'client-individual', 'activemq.prefetchSize' => 1}) do |msg|
14
- @timer_thread.stop_timer
16
+ @stomp_client.subscribe(@request_queue, {:ack => 'client-individual', 'activemq.prefetchSize' => 1}) do |msg|
17
+ @timer.stop
15
18
  request = @serialization_provider.deserialize(msg)
16
19
  handling_strategy.process_next_request_from(self, request)
17
- @timer_thread.start_timer
20
+ @timer.start
18
21
  end
19
22
  end
20
23
 
21
24
  def respond_to(request, response)
22
25
  serialized_response = @serialization_provider.serialize(response)
23
- @stomp_client.publish("/queue/#{@unique_id}.resp", serialized_response)
26
+ @stomp_client.publish(@response_queue, serialized_response)
24
27
  @stomp_client.acknowledge(request.original_message)
25
28
  end
26
29
 
27
30
  def join
28
- @timer_thread.start_timer
29
31
  @stomp_client.join
30
32
  end
31
33
 
32
34
  def close
35
+ @stomp_client.unsubscribe(@request_queue)
33
36
  @stomp_client.close
34
37
  end
35
38
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdl-client-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.2
4
+ version: 0.19.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Ghionoiu
@@ -221,7 +221,7 @@ homepage: https://github.com/julianghionoiu/tdl-client-ruby
221
221
  licenses:
222
222
  - GPL-3.0
223
223
  metadata:
224
- previous_version: 0.19.1
224
+ previous_version: 0.19.2
225
225
  post_install_message:
226
226
  rdoc_options: []
227
227
  require_paths: