Ruby RabbitMQ clients blog

News and updates about various Ruby clients for RabbitMQ

Bunny 0.9.0.rc1 Is Released

TL;DR

Bunny 0.9.0.rc1 is released to rubygems.org.

This release adds TLS support and a couple of minor improvements. Bunny 0.9 is now feature complete and used widely enough for us to be confident about labelling this an RC.

Changes between Bunny 0.9.0.pre13 and 0.9.0.rc1

TLS Support

Bunny 0.9 finally supports TLS. There are 3 new options Bunny.new takes:

  • :tls which, when set to true, will set SSL context up and switch to TLS port (5671)
  • :tls_cert which is a string path to the client certificate (public key) in PEM format
  • :tls_key which is a string path to the client key (private key) in PEM format
  • :tls_ca_certificates which is an array of string paths to CA certificates in PEM format

An example:

1
2
3
4
conn = Bunny.new(:tls                   => true,
                 :tls_cert              => "examples/tls/client_cert.pem",
                 :tls_key               => "examples/tls/client_key.pem",
                 :tls_ca_certificates   => ["./examples/tls/cacert.pem"])

Bunny::Queue#pop_waiting

Bunny::Queue#pop_waiting is a new function that mimics Bunny::Queue#pop but will wait until a message is available. It uses a :timeout option and will raise an exception if the timeout is hit:

1
2
3
4
5
6
7
8
# given 1 message in the queue,
# works exactly as Bunny::Queue#get
q.pop_waiting

# given no messages in the queue, will wait for up to 0.5 seconds
# for a message to become available. Raises an exception if the timeout
# is hit
q.pop_waiting(:timeout => 0.5)

This method only makes sense for collecting Request/Reply (“RPC”) replies.

Bunny::InvalidCommand is now Bunny::CommandInvalid

Bunny::InvalidCommand is now Bunny::CommandInvalid (follows the exception class naming convention based on response status name).

Full change log can be found on GitHub.

Plans for 0.9.0 Final

There is still a few things we need to do before Bunny 0.9 final:

  • Fix any remaining important issues we get reports for
  • Make configuring low-level socket and SSL context

We will also make improvements to the documentation guides.

Michael on behalf of the Ruby RabbitMQ Clients Team