bunny 2.7.4 → 2.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +61 -35
  3. data/lib/bunny/channel.rb +186 -50
  4. data/lib/bunny/channel_id_allocator.rb +3 -1
  5. data/lib/bunny/consumer.rb +2 -2
  6. data/lib/bunny/consumer_work_pool.rb +2 -1
  7. data/lib/bunny/cruby/socket.rb +3 -0
  8. data/lib/bunny/cruby/ssl_socket.rb +6 -1
  9. data/lib/bunny/delivery_info.rb +1 -1
  10. data/lib/bunny/heartbeat_sender.rb +2 -1
  11. data/lib/bunny/jruby/ssl_socket.rb +5 -0
  12. data/lib/bunny/queue.rb +36 -8
  13. data/lib/bunny/reader_loop.rb +22 -10
  14. data/lib/bunny/session.rb +152 -65
  15. data/lib/bunny/test_kit.rb +14 -0
  16. data/lib/bunny/transport.rb +132 -49
  17. data/lib/bunny/version.rb +1 -1
  18. data/lib/bunny.rb +45 -4
  19. metadata +37 -225
  20. data/.github/ISSUE_TEMPLATE.md +0 -18
  21. data/.gitignore +0 -28
  22. data/.rspec +0 -1
  23. data/.travis.yml +0 -20
  24. data/.yardopts +0 -8
  25. data/CONTRIBUTING.md +0 -111
  26. data/ChangeLog.md +0 -1831
  27. data/Gemfile +0 -53
  28. data/LICENSE +0 -21
  29. data/Rakefile +0 -46
  30. data/benchmarks/basic_publish/with_128K_messages.rb +0 -35
  31. data/benchmarks/basic_publish/with_1k_messages.rb +0 -35
  32. data/benchmarks/basic_publish/with_4K_messages.rb +0 -35
  33. data/benchmarks/basic_publish/with_64K_messages.rb +0 -35
  34. data/benchmarks/channel_open.rb +0 -28
  35. data/benchmarks/mutex_and_monitor.rb +0 -42
  36. data/benchmarks/queue_declare.rb +0 -29
  37. data/benchmarks/queue_declare_and_bind.rb +0 -29
  38. data/benchmarks/queue_declare_bind_and_delete.rb +0 -29
  39. data/benchmarks/synchronized_sorted_set.rb +0 -53
  40. data/benchmarks/write_vs_write_nonblock.rb +0 -49
  41. data/bin/ci/before_build +0 -46
  42. data/bunny.gemspec +0 -35
  43. data/docker/Dockerfile +0 -16
  44. data/docker/docker-entrypoint.sh +0 -37
  45. data/docker-compose.yml +0 -18
  46. data/examples/connection/authentication_failure.rb +0 -16
  47. data/examples/connection/automatic_recovery_with_basic_get.rb +0 -40
  48. data/examples/connection/automatic_recovery_with_client_named_queues.rb +0 -36
  49. data/examples/connection/automatic_recovery_with_multiple_consumers.rb +0 -46
  50. data/examples/connection/automatic_recovery_with_republishing.rb +0 -109
  51. data/examples/connection/automatic_recovery_with_server_named_queues.rb +0 -35
  52. data/examples/connection/channel_level_exception.rb +0 -27
  53. data/examples/connection/disabled_automatic_recovery.rb +0 -34
  54. data/examples/connection/heartbeat.rb +0 -17
  55. data/examples/connection/manually_reconnecting_consumer.rb +0 -23
  56. data/examples/connection/manually_reconnecting_publisher.rb +0 -28
  57. data/examples/connection/unknown_host.rb +0 -16
  58. data/examples/consumers/high_and_low_priority.rb +0 -50
  59. data/examples/guides/exchanges/direct_exchange_routing.rb +0 -36
  60. data/examples/guides/exchanges/fanout_exchange_routing.rb +0 -28
  61. data/examples/guides/exchanges/headers_exchange_routing.rb +0 -31
  62. data/examples/guides/exchanges/mandatory_messages.rb +0 -30
  63. data/examples/guides/extensions/alternate_exchange.rb +0 -30
  64. data/examples/guides/extensions/basic_nack.rb +0 -33
  65. data/examples/guides/extensions/connection_blocked.rb +0 -35
  66. data/examples/guides/extensions/consumer_cancellation_notification.rb +0 -39
  67. data/examples/guides/extensions/dead_letter_exchange.rb +0 -32
  68. data/examples/guides/extensions/exchange_to_exchange_bindings.rb +0 -29
  69. data/examples/guides/extensions/per_message_ttl.rb +0 -36
  70. data/examples/guides/extensions/per_queue_message_ttl.rb +0 -36
  71. data/examples/guides/extensions/publisher_confirms.rb +0 -28
  72. data/examples/guides/extensions/queue_lease.rb +0 -26
  73. data/examples/guides/extensions/sender_selected_distribution.rb +0 -32
  74. data/examples/guides/getting_started/blabbr.rb +0 -27
  75. data/examples/guides/getting_started/hello_world.rb +0 -22
  76. data/examples/guides/getting_started/weathr.rb +0 -49
  77. data/examples/guides/queues/one_off_consumer.rb +0 -25
  78. data/examples/guides/queues/redeliveries.rb +0 -81
  79. data/profiling/basic_publish/with_4K_messages.rb +0 -33
  80. data/repl +0 -3
  81. data/spec/config/enabled_plugins +0 -1
  82. data/spec/config/rabbitmq.config +0 -19
  83. data/spec/higher_level_api/integration/basic_ack_spec.rb +0 -230
  84. data/spec/higher_level_api/integration/basic_cancel_spec.rb +0 -142
  85. data/spec/higher_level_api/integration/basic_consume_spec.rb +0 -349
  86. data/spec/higher_level_api/integration/basic_consume_with_objects_spec.rb +0 -54
  87. data/spec/higher_level_api/integration/basic_get_spec.rb +0 -80
  88. data/spec/higher_level_api/integration/basic_nack_spec.rb +0 -82
  89. data/spec/higher_level_api/integration/basic_publish_spec.rb +0 -74
  90. data/spec/higher_level_api/integration/basic_qos_spec.rb +0 -57
  91. data/spec/higher_level_api/integration/basic_reject_spec.rb +0 -152
  92. data/spec/higher_level_api/integration/basic_return_spec.rb +0 -33
  93. data/spec/higher_level_api/integration/channel_close_spec.rb +0 -25
  94. data/spec/higher_level_api/integration/channel_open_spec.rb +0 -57
  95. data/spec/higher_level_api/integration/connection_recovery_spec.rb +0 -471
  96. data/spec/higher_level_api/integration/connection_spec.rb +0 -559
  97. data/spec/higher_level_api/integration/connection_stop_spec.rb +0 -83
  98. data/spec/higher_level_api/integration/consumer_cancellation_notification_spec.rb +0 -128
  99. data/spec/higher_level_api/integration/dead_lettering_spec.rb +0 -75
  100. data/spec/higher_level_api/integration/exchange_bind_spec.rb +0 -31
  101. data/spec/higher_level_api/integration/exchange_declare_spec.rb +0 -237
  102. data/spec/higher_level_api/integration/exchange_delete_spec.rb +0 -105
  103. data/spec/higher_level_api/integration/exchange_unbind_spec.rb +0 -40
  104. data/spec/higher_level_api/integration/exclusive_queue_spec.rb +0 -28
  105. data/spec/higher_level_api/integration/heartbeat_spec.rb +0 -49
  106. data/spec/higher_level_api/integration/merry_go_round_spec.rb +0 -85
  107. data/spec/higher_level_api/integration/message_properties_access_spec.rb +0 -95
  108. data/spec/higher_level_api/integration/predeclared_exchanges_spec.rb +0 -24
  109. data/spec/higher_level_api/integration/publisher_confirms_spec.rb +0 -191
  110. data/spec/higher_level_api/integration/publishing_edge_cases_spec.rb +0 -87
  111. data/spec/higher_level_api/integration/queue_bind_spec.rb +0 -109
  112. data/spec/higher_level_api/integration/queue_declare_spec.rb +0 -221
  113. data/spec/higher_level_api/integration/queue_delete_spec.rb +0 -41
  114. data/spec/higher_level_api/integration/queue_purge_spec.rb +0 -30
  115. data/spec/higher_level_api/integration/queue_unbind_spec.rb +0 -54
  116. data/spec/higher_level_api/integration/read_only_consumer_spec.rb +0 -60
  117. data/spec/higher_level_api/integration/sender_selected_distribution_spec.rb +0 -36
  118. data/spec/higher_level_api/integration/tls_connection_spec.rb +0 -222
  119. data/spec/higher_level_api/integration/tx_commit_spec.rb +0 -21
  120. data/spec/higher_level_api/integration/tx_rollback_spec.rb +0 -21
  121. data/spec/higher_level_api/integration/with_channel_spec.rb +0 -25
  122. data/spec/issues/issue100_spec.rb +0 -42
  123. data/spec/issues/issue141_spec.rb +0 -43
  124. data/spec/issues/issue202_spec.rb +0 -15
  125. data/spec/issues/issue224_spec.rb +0 -40
  126. data/spec/issues/issue465_spec.rb +0 -32
  127. data/spec/issues/issue78_spec.rb +0 -72
  128. data/spec/issues/issue83_spec.rb +0 -30
  129. data/spec/issues/issue97_attachment.json +0 -1
  130. data/spec/issues/issue97_spec.rb +0 -175
  131. data/spec/lower_level_api/integration/basic_cancel_spec.rb +0 -83
  132. data/spec/lower_level_api/integration/basic_consume_spec.rb +0 -99
  133. data/spec/spec_helper.rb +0 -51
  134. data/spec/stress/channel_close_stress_spec.rb +0 -64
  135. data/spec/stress/channel_open_stress_spec.rb +0 -84
  136. data/spec/stress/channel_open_stress_with_single_threaded_connection_spec.rb +0 -28
  137. data/spec/stress/concurrent_consumers_stress_spec.rb +0 -71
  138. data/spec/stress/concurrent_publishers_stress_spec.rb +0 -54
  139. data/spec/stress/connection_open_close_spec.rb +0 -52
  140. data/spec/stress/long_running_consumer_spec.rb +0 -84
  141. data/spec/tls/ca_certificate.pem +0 -29
  142. data/spec/tls/ca_key.pem +0 -52
  143. data/spec/tls/client_certificate.pem +0 -29
  144. data/spec/tls/client_key.pem +0 -51
  145. data/spec/tls/generate-server-cert.sh +0 -8
  146. data/spec/tls/server-openssl.cnf +0 -10
  147. data/spec/tls/server.csr +0 -16
  148. data/spec/tls/server_certificate.pem +0 -29
  149. data/spec/tls/server_key.pem +0 -51
  150. data/spec/unit/bunny_spec.rb +0 -15
  151. data/spec/unit/concurrent/atomic_fixnum_spec.rb +0 -35
  152. data/spec/unit/concurrent/condition_spec.rb +0 -82
  153. data/spec/unit/concurrent/linked_continuation_queue_spec.rb +0 -35
  154. data/spec/unit/concurrent/synchronized_sorted_set_spec.rb +0 -73
  155. data/spec/unit/exchange_recovery_spec.rb +0 -39
  156. data/spec/unit/version_delivery_tag_spec.rb +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 67acdd00ad8e7f36b89bcf6043cca832b5ee9ed8
4
- data.tar.gz: 3fcc3fedbafc611804bf76f0be43e211f8292f75
2
+ SHA256:
3
+ metadata.gz: 2edd88411f92dbdbb1d06b334006e446d5b3e3fb165f3baae3745bd066cf9651
4
+ data.tar.gz: 437032f606bb6f77fee02e65706e615f8a52c0e05467bbe257f1796fcedd624c
5
5
  SHA512:
6
- metadata.gz: f730e0dd7c1777043f3fa31b3316df10bb7d12f880d4d0d48cff481d8ab199f667f5399a4de7a059b61a3ad520739448d12ca7f8eca87b90f6bef897f4ca2add
7
- data.tar.gz: eeff99bc77bb6b95c0c4f84704c699166fd1ca0c29a21c78dde60ca545042f85cf7f5115c58fbc8575f614063ccccd10239ef9bd42a9bb43343e101470679c8d
6
+ metadata.gz: 698398dc76ca4e3dd11e3c5dc6b078998f23895bd3d975b01e1329c08c8ff0835cb9691d0108f0f6e13aaa769b870b258ff5e1de1958321be4804ca99b30a0be
7
+ data.tar.gz: 2a1fdcc61d683a991d07f601a986c5bc04d40cdd7155a1833dc7dba46be014c23d36612c505531b2f2adfe08ed057d6a493cbf5df368318205ffaf88659a88fb
data/README.md CHANGED
@@ -7,7 +7,7 @@ have any heavyweight dependencies.
7
7
 
8
8
  ## I Know What RabbitMQ and Bunny are, How Do I Get Started?
9
9
 
10
- [Right here](http://rubybunny.info/articles/getting_started.html)!
10
+ [Right here](https://www.rabbitmq.com/getstarted.html)!
11
11
 
12
12
 
13
13
  ## What is Bunny Good For?
@@ -43,12 +43,17 @@ Specific examples:
43
43
  Web applications that display that information in the real time.
44
44
 
45
45
 
46
-
47
46
  ## Supported Ruby Versions
48
47
 
49
48
  Modern Bunny versions support
50
49
 
51
- * CRuby 2.0 through 2.4
50
+ * CRuby 2.6 through 3.1 (inclusive)
51
+ * [TruffleRuby](https://www.graalvm.org/ruby/)
52
+
53
+ For environments that use TLS, Bunny expects Ruby installations to use a recent enough OpenSSL version that
54
+ **includes support for TLS 1.3**.
55
+
56
+ ### JRuby
52
57
 
53
58
  Bunny works sufficiently well on JRuby but there are known
54
59
  JRuby bugs in versions prior to JRuby 9000 that cause high CPU burn. JRuby users should
@@ -59,15 +64,20 @@ Bunny `1.7.x` was the last version to support CRuby 1.9.3 and 1.8.7
59
64
 
60
65
  ## Supported RabbitMQ Versions
61
66
 
62
- Bunny `1.5.0` and later versions only support RabbitMQ `3.3+`.
63
- Bunny `1.4.x` and earlier supports RabbitMQ 2.x and 3.x.
67
+ Modern Bunny releases target [currently supported RabbitMQ release series](https://www.rabbitmq.com/versions.html).
64
68
 
65
69
 
66
- ## Project Maturity
70
+ ## Change Log
67
71
 
68
72
  Bunny is a mature library (started in early 2009) with
69
73
  a stable public API.
70
74
 
75
+ Change logs per release series:
76
+
77
+ * [main](https://github.com/ruby-amqp/bunny/blob/main/ChangeLog.md) (most notable changes for all release series)
78
+ * [2.19.x](https://github.com/ruby-amqp/bunny/blob/2.19.x-stable/ChangeLog.md)
79
+
80
+
71
81
 
72
82
  ## Installation & Bundler Dependency
73
83
 
@@ -75,20 +85,20 @@ a stable public API.
75
85
 
76
86
  [![Gem Version](https://badge.fury.io/rb/bunny.svg)](http://badge.fury.io/rb/bunny)
77
87
 
78
- ### With Rubygems
88
+ ### Bundler Dependency
79
89
 
80
- To install Bunny with RubyGems:
90
+ To use Bunny in a project managed with Bundler:
81
91
 
82
- ```
83
- gem install bunny
92
+ ``` ruby
93
+ gem "bunny", ">= 2.19.0"
84
94
  ```
85
95
 
86
- ### Bundler Dependency
96
+ ### With Rubygems
87
97
 
88
- To use Bunny in a project managed with Bundler:
98
+ To install Bunny with RubyGems:
89
99
 
90
- ``` ruby
91
- gem "bunny", ">= 2.7.2"
100
+ ```
101
+ gem install bunny
92
102
  ```
93
103
 
94
104
 
@@ -97,7 +107,7 @@ gem "bunny", ">= 2.7.2"
97
107
  Below is a small snippet that demonstrates how to publish
98
108
  and synchronously consume ("pull API") messages with Bunny.
99
109
 
100
- For a 15 minute tutorial using more practical examples, see [Getting Started with RabbitMQ and Ruby using Bunny](http://rubybunny.info/articles/getting_started.html).
110
+ For a 15 minute tutorial using more practical examples, see [Getting Started with RabbitMQ and Ruby using Bunny](https://www.rabbitmq.com/tutorials/tutorial-one-ruby.html).
101
111
 
102
112
  ``` ruby
103
113
  require "bunny"
@@ -108,20 +118,31 @@ conn.start
108
118
 
109
119
  # open a channel
110
120
  ch = conn.create_channel
121
+ ch.confirm_select
111
122
 
112
123
  # declare a queue
113
124
  q = ch.queue("test1")
125
+ q.subscribe(manual_ack: true) do |delivery_info, metadata, payload|
126
+ puts "This is the message: #{payload}"
127
+ # acknowledge the delivery so that RabbitMQ can mark it for deletion
128
+ ch.ack(delivery_info.delivery_tag)
129
+ end
114
130
 
115
131
  # publish a message to the default exchange which then gets routed to this queue
116
132
  q.publish("Hello, everybody!")
117
133
 
118
- # fetch a message from the queue
119
- delivery_info, metadata, payload = q.pop
134
+ # await confirmations from RabbitMQ, see
135
+ # https://www.rabbitmq.com/publishers.html#data-safety for details
136
+ ch.wait_for_confirms
137
+
138
+ # give the above consumer some time consume the delivery and print out the message
139
+ sleep 1
120
140
 
121
- puts "This is the message: #{payload}"
141
+ puts "Done"
122
142
 
143
+ ch.close
123
144
  # close the connection
124
- conn.stop
145
+ conn.close
125
146
  ```
126
147
 
127
148
 
@@ -133,17 +154,29 @@ For a 15 minute tutorial using more practical examples, see [Getting Started wit
133
154
 
134
155
  ### Guides
135
156
 
136
- Other documentation guides are available at [rubybunny.info](http://rubybunny.info):
157
+ Bunny documentation guides are [under `docs/guides` in this repository](https://github.com/ruby-amqp/bunny/tree/main/docs/guides):
137
158
 
138
- * [Queues and Consumers](http://rubybunny.info/articles/queues.html)
139
- * [Exchanges and Publishers](http://rubybunny.info/articles/exchanges.html)
159
+ * [Queues and Consumers](https://github.com/ruby-amqp/bunny/tree/main/docs/guides/queues.md)
160
+ * [Exchanges and Publishers](https://github.com/ruby-amqp/bunny/tree/main/docs/guides/exchanges.md)
140
161
  * [AMQP 0.9.1 Model Explained](http://www.rabbitmq.com/tutorials/amqp-concepts.html)
141
- * [Connecting to RabbitMQ](http://rubybunny.info/articles/connecting.html)
142
- * [Error Handling and Recovery](http://rubybunny.info/articles/error_handling.html)
143
- * [TLS/SSL Support](http://rubybunny.info/articles/tls.html)
144
- * [Bindings](http://rubybunny.info/articles/bindings.html)
145
- * [Using RabbitMQ Extensions with Bunny](http://rubybunny.info/articles/extensions.html)
146
- * [Durability and Related Matters](http://rubybunny.info/articles/durability.html)
162
+ * [Connecting to RabbitMQ](https://github.com/ruby-amqp/bunny/tree/main/docs/guides/connecting.md)
163
+ * [Error Handling and Recovery](https://github.com/ruby-amqp/bunny/tree/main/docs/guides/error_handling.md)
164
+ * [TLS/SSL Support](https://github.com/ruby-amqp/bunny/tree/main/docs/guides/tls.md)
165
+ * [Bindings](https://github.com/ruby-amqp/bunny/tree/main/docs/guides/bindings.md)
166
+ * [Using RabbitMQ Extensions with Bunny](https://github.com/ruby-amqp/bunny/tree/main/docs/guides/extensions.md)
167
+ * [Durability and Related Matters](https://github.com/ruby-amqp/bunny/tree/main/docs/guides/durability.md)
168
+
169
+ Some highly relevant RabbitMQ documentation guides:
170
+
171
+ * [Connections](https://www.rabbitmq.com/connections.html)
172
+ * [Channels](https://www.rabbitmq.com/channels.html)
173
+ * [Queues](https://www.rabbitmq.com/queues.html)
174
+ * [Quorum queues](https://www.rabbitmq.com/quorum-queues.html)
175
+ * [Streams](https://rabbitmq.com/streams.html) (Bunny can perform basic operations on streams even though it does not implement the [RabbitMQ Stream protocol](https://github.com/rabbitmq/rabbitmq-server/blob/v3.10.x/deps/rabbitmq_stream/docs/PROTOCOL.adoc))
176
+ * [Publishers](https://www.rabbitmq.com/publishers.html)
177
+ * [Consumers](https://www.rabbitmq.com/consumers.html)
178
+ * Data safety: publisher and consumer [Confirmations](https://www.rabbitmq.com/confirms.html)
179
+ * [Production Checklist](https://www.rabbitmq.com/production-checklist.html)
147
180
 
148
181
  ### API Reference
149
182
 
@@ -167,13 +200,6 @@ mailing list. Feel free to ask any questions that you may have.
167
200
  [![Build Status](https://travis-ci.org/ruby-amqp/bunny.svg)](https://travis-ci.org/ruby-amqp/bunny/)
168
201
 
169
202
 
170
- ### News & Announcements on Twitter
171
-
172
- To subscribe for announcements of releases, important changes and so on, please follow [@rubyamqp](https://twitter.com/#!/rubyamqp) on Twitter.
173
-
174
- More detailed announcements can be found in the [RabbitMQ Ruby clients blog](http://blog.rubyrabbitmq.info).
175
-
176
-
177
203
  ### Reporting Issues
178
204
 
179
205
  If you find a bug you understand well, poor default, incorrect or unclear piece of documentation,