bunny 2.23.0 → 3.0.0

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -36
  3. data/lib/amq/protocol/extensions.rb +2 -0
  4. data/lib/bunny/authentication/credentials_encoder.rb +2 -0
  5. data/lib/bunny/authentication/external_mechanism_encoder.rb +2 -0
  6. data/lib/bunny/authentication/plain_mechanism_encoder.rb +2 -0
  7. data/lib/bunny/channel.rb +778 -150
  8. data/lib/bunny/channel_id_allocator.rb +2 -0
  9. data/lib/bunny/concurrent/atomic_fixnum.rb +2 -0
  10. data/lib/bunny/concurrent/condition.rb +2 -0
  11. data/lib/bunny/concurrent/continuation_queue.rb +2 -0
  12. data/lib/bunny/concurrent/exception_accumulator.rb +115 -0
  13. data/lib/bunny/concurrent/synchronized_sorted_set.rb +2 -0
  14. data/lib/bunny/consumer.rb +4 -11
  15. data/lib/bunny/consumer_tag_generator.rb +2 -0
  16. data/lib/bunny/consumer_work_pool.rb +2 -0
  17. data/lib/bunny/cruby/socket.rb +36 -2
  18. data/lib/bunny/cruby/ssl_socket.rb +44 -1
  19. data/lib/bunny/delivery_info.rb +23 -15
  20. data/lib/bunny/exceptions.rb +33 -2
  21. data/lib/bunny/exchange.rb +27 -13
  22. data/lib/bunny/framing.rb +2 -0
  23. data/lib/bunny/get_response.rb +20 -14
  24. data/lib/bunny/heartbeat_sender.rb +4 -2
  25. data/lib/bunny/message_properties.rb +2 -0
  26. data/lib/bunny/queue.rb +31 -39
  27. data/lib/bunny/reader_loop.rb +9 -7
  28. data/lib/bunny/return_info.rb +18 -11
  29. data/lib/bunny/session.rb +387 -63
  30. data/lib/bunny/socket.rb +7 -12
  31. data/lib/bunny/ssl_socket.rb +7 -12
  32. data/lib/bunny/test_kit.rb +1 -0
  33. data/lib/bunny/timeout.rb +2 -0
  34. data/lib/bunny/timestamp.rb +3 -1
  35. data/lib/bunny/topology_recovery_filter.rb +71 -0
  36. data/lib/bunny/topology_registry.rb +824 -0
  37. data/lib/bunny/transport.rb +54 -49
  38. data/lib/bunny/version.rb +2 -1
  39. data/lib/bunny.rb +2 -1
  40. metadata +25 -14
  41. data/lib/bunny/concurrent/linked_continuation_queue.rb +0 -61
  42. data/lib/bunny/jruby/socket.rb +0 -57
  43. data/lib/bunny/jruby/ssl_socket.rb +0 -58
  44. data/lib/bunny/versioned_delivery_tag.rb +0 -28
@@ -1,14 +1,9 @@
1
- # See #165. MK.
2
- if defined?(JRUBY_VERSION)
3
- require "bunny/jruby/ssl_socket"
1
+ # frozen_string_literal: true
4
2
 
5
- module Bunny
6
- SSLSocketImpl = JRuby::SSLSocket
7
- end
8
- else
9
- require "bunny/cruby/ssl_socket"
3
+ require "bunny/cruby/ssl_socket"
10
4
 
11
- module Bunny
12
- SSLSocketImpl = SSLSocket
13
- end
14
- end
5
+ module Bunny
6
+ # An alias for the standard SSLSocket,
7
+ # exists from the days of JRuby support.
8
+ SSLSocketImpl = SSLSocket
9
+ end
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "timeout"
4
5
 
data/lib/bunny/timeout.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bunny
2
4
  Timeout = ::Timeout
3
5
 
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bunny
2
- # Abstracts away the Ruby (OS) method of retriving timestamps.
4
+ # Abstracts away the Ruby (OS) method of retrieving timestamps.
3
5
  #
4
6
  # @private
5
7
  class Timestamp
@@ -0,0 +1,71 @@
1
+ # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: true
3
+
4
+ module Bunny
5
+ # Passed to [Bunny::TopologyRegistry] to filter entities
6
+ # during topology recovery.
7
+ #
8
+ # @abstract Override to implement the filtering functions.
9
+ #
10
+ # @see Bunny::TopologyRegistry
11
+ class TopologyRecoveryFilter
12
+ # Returns a collection of exchanges that should be recovered during topology recovery.
13
+ # @abstract Override to implement exchange filtering
14
+ # @param xs [Array<Bunny::RecordedExchange>]
15
+ # @return [Array<Bunny::RecordedExchange>]
16
+ def filter_exchanges(xs); raise NotImplementedError; end
17
+
18
+ # Returns a collection of queues that should be recovered during topology recovery.
19
+ # @abstract Override to implement queue filtering.
20
+ # @param qs [Array<Bunny::RecordedQueue>]
21
+ # @return [Array<Bunny::RecordedQueue>]
22
+ def filter_queues(qs); raise NotImplementedError; end
23
+
24
+ # Returns a collection of exchange bindings that should be recovered during topology recovery.
25
+ # @abstract Override to implement exchange binding filtering
26
+ # @param bs [Set<Bunny::RecordedExchangeBinding>]
27
+ # @return [Array<Bunny::RecordedExchangeBinding>, Set<Bunny::RecordedExchangeBinding>]
28
+ def filter_exchange_bindings(bs); raise NotImplementedError; end
29
+
30
+ # Returns a collection of queue bindings that should be recovered during topology recovery.
31
+ # @abstract Override to implement queue binding filtering
32
+ # @param bs [Set<Bunny::RecordedQueueBinding>]
33
+ # @return [Array<Bunny::RecordedQueueBinding>, Set<Bunny::RecordedQueueBinding>]
34
+ def filter_queue_bindings(bs); raise NotImplementedError; end
35
+
36
+ # Returns a collection of consumers that should be recovered during topology recovery.
37
+ # @abstract Override to implement consumer filtering
38
+ # @param bs [Array<Bunny::RecordedConsumer>]
39
+ # @return [Array<Bunny::RecordedConsumer>]
40
+ def filter_consumers(bs); raise NotImplementedError; end
41
+ end
42
+
43
+ # A no-op topology recovery filter. All methods return
44
+ # their inputs exactly as they are.
45
+ class DefaultTopologyRecoveryFilter < TopologyRecoveryFilter
46
+ # Returns the input without any filtering.
47
+ # @param xs [Array<Bunny::RecordedExchange>]
48
+ # @return [Array<Bunny::RecordedExchange>]
49
+ def filter_exchanges(xs); xs; end
50
+
51
+ # Returns the input without any filtering.
52
+ # @param qs [Array<Bunny::RecordedQueue>]
53
+ # @return [Array<Bunny::RecordedQueue>]
54
+ def filter_queues(qs); qs; end
55
+
56
+ # Returns the input without any filtering.
57
+ # @param bs [Set<Bunny::RecordedExchangeBinding>]
58
+ # @return [Array<Bunny::RecordedExchangeBinding>, Set<Bunny::RecordedExchangeBinding>]
59
+ def filter_exchange_bindings(bs); bs; end
60
+
61
+ # Returns the input without any filtering.
62
+ # @param bs [Set<Bunny::RecordedQueueBinding>]
63
+ # @return [Array<Bunny::RecordedQueueBinding>, Set<Bunny::RecordedQueueBinding>]
64
+ def filter_queue_bindings(bs); bs; end
65
+
66
+ # Returns the input without any filtering.
67
+ # @param cs [Array<Bunny::RecordedConsumer>]
68
+ # @return [Array<Bunny::RecordedConsumer>]
69
+ def filter_consumers(cs); cs; end
70
+ end
71
+ end