beetle 3.4.3 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64be33377e4235036fac944de3c020f03fc53e426a1969b729ca0db016351cae
4
- data.tar.gz: 7fde625b27bce1814ba5840b92898b7cb365f1d04b743584b59e15e6bb9d7da7
3
+ metadata.gz: cb4bee36ae48b68aa27483c59aea588aa1a263c7c33858738ce6471246e1bb96
4
+ data.tar.gz: 93f380bb4596fcabfc48bec927ba7767b04b826750c307934ed937023c7a8152
5
5
  SHA512:
6
- metadata.gz: 990d179e32cad50f9d51ec3f3bf8e4e3d518b8f1925995277917ae5553dfd3fd72dd510558a3f2f5ddbc815b57f5a8719f3854b18b2680a620f76dda1bb411b5
7
- data.tar.gz: 42e77ac9b05035ec28891cdf43eb8ba0706e835a52d4c1906843a7d9f1cf8a9a211c332c2d031c5b044b2f4cebbf40ca94a8dd20eda99abc0af0c8cf9ce9ce29
6
+ metadata.gz: 34d0e2001a1f93f8b88a86992a77bda65acddc1913c550798144c62fc11b77b7da0dcc0b0c270edd38aa7d27b7ea5f1d0f03fe2a955154db0f91759f5aaa2aee
7
+ data.tar.gz: 7ee1364e4fc0e6c6d8cefb1f10c5d4baa0fa6c7a1bd1434a710169538d104b4b83016faa3fb3bb6616bbae1c1db668953f24acd9c342d481b20b6e5d41c967de
@@ -1,5 +1,8 @@
1
1
  = Release Notes
2
2
 
3
+ == Version 3.5.0
4
+ * expose publisher method to setup queues/policies ahead of use
5
+
3
6
  == Version 3.4.3
4
7
  * optimize declaration of queues with many bindings
5
8
 
@@ -280,6 +280,13 @@ module Beetle
280
280
  publisher.throttled?
281
281
  end
282
282
 
283
+ # set up queues and policies for all configured queues. Otherwise this will
284
+ # happen on first use of an exchange, which can be undesired for latency
285
+ # sensitive endpoints. Only needs to be called once.
286
+ def setup_queues_and_policies
287
+ publisher.setup_queues_and_policies
288
+ end
289
+
283
290
  # traces queues without consuming them. useful for debugging message flow.
284
291
  def trace(queue_names=self.queues.keys, tracer=nil, &block)
285
292
  queues_to_trace = self.queues.slice(*queue_names)
@@ -169,10 +169,14 @@ module Beetle
169
169
  end
170
170
  end
171
171
 
172
- def setup_queues_and_policies(queue_names) #:nodoc:
172
+ def setup_queues_and_policies
173
173
  each_server do
174
- queue_names.each do |name|
175
- queue(name, create_policies: true)
174
+ begin
175
+ @client.queues.keys.each do |name|
176
+ queue(name)
177
+ end
178
+ rescue => e
179
+ logger.warn "Beetle: failed setting up queues and policies on #{@server}: #{e}"
176
180
  end
177
181
  end
178
182
  end
@@ -1,3 +1,3 @@
1
1
  module Beetle
2
- VERSION = "3.4.3"
2
+ VERSION = "3.5.0"
3
3
  end
@@ -282,6 +282,12 @@ module Beetle
282
282
  client.stop_publishing
283
283
  end
284
284
 
285
+ test "should delegate setup_queues_and_policies to the publisher instance" do
286
+ client = Client.new
287
+ client.send(:publisher).expects(:setup_queues_and_policies)
288
+ client.setup_queues_and_policies
289
+ end
290
+
285
291
  test "should delegate queue purging to the publisher instance" do
286
292
  client = Client.new
287
293
  client.register_queue(:queue)
@@ -355,14 +355,34 @@ module Beetle
355
355
  end
356
356
 
357
357
  test "setting up queues and policies should iterate over all servers" do
358
- @pub.servers = %w(a b)
359
- queue = mock("queue")
358
+ client = Client.new
359
+ client.register_queue("queue")
360
+ pub = Publisher.new(client)
361
+ pub.servers = %w(a b)
362
+
360
363
  s = sequence("setup")
361
- @pub.expects(:set_current_server).with("a").in_sequence(s)
362
- @pub.expects(:queue).with("queue", :create_policies => true).returns(queue).in_sequence(s)
363
- @pub.expects(:set_current_server).with("b").in_sequence(s)
364
- @pub.expects(:queue).with("queue", :create_policies => true).returns(queue).in_sequence(s)
365
- @pub.setup_queues_and_policies(["queue"])
364
+ pub.expects(:set_current_server).with("a").in_sequence(s)
365
+ pub.expects(:queue).with(client.config.beetle_policy_updates_queue_name).in_sequence(s)
366
+ pub.expects(:queue).with("queue").in_sequence(s)
367
+ pub.expects(:set_current_server).with("b").in_sequence(s)
368
+ pub.expects(:queue).with(client.config.beetle_policy_updates_queue_name).in_sequence(s)
369
+ pub.expects(:queue).with("queue").in_sequence(s)
370
+
371
+ pub.setup_queues_and_policies()
372
+ end
373
+
374
+ test "setting up queues and policies should handle ephemeral errors" do
375
+ client = Client.new
376
+ pub = Publisher.new(client)
377
+ client.register_queue("queue")
378
+ pub.servers = %w(a b)
379
+ pub.stubs(:queue).raises(StandardError)
380
+
381
+ s = sequence("setup")
382
+ pub.expects(:set_current_server).with("a").in_sequence(s)
383
+ pub.expects(:set_current_server).with("b").in_sequence(s)
384
+
385
+ pub.setup_queues_and_policies()
366
386
  end
367
387
 
368
388
  test "reports whether it has been throttled" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beetle
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.3
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Kaes
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2021-01-21 00:00:00.000000000 Z
15
+ date: 2021-01-22 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bunny