Method: Bunny::Channel#queue_declare
- Defined in:
- lib/bunny/channel.rb
#queue_declare(name, opts = {}) ⇒ AMQ::Protocol::Queue::DeclareOk
Declares a queue using queue.declare AMQP 0.9.1 method.
1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 |
# File 'lib/bunny/channel.rb', line 1125 def queue_declare(name, opts = {}) raise_if_no_longer_open! Bunny::Queue.verify_type!(opts[:arguments]) if opts[:arguments] # strip trailing new line and carriage returns # just like RabbitMQ does safe_name = name.gsub(/[\r\n]/, "") @pending_queue_declare_name = safe_name @connection.send_frame( AMQ::Protocol::Queue::Declare.encode(@id, @pending_queue_declare_name, opts.fetch(:passive, false), opts.fetch(:durable, false), opts.fetch(:exclusive, false), opts.fetch(:auto_delete, false), false, opts[:arguments])) begin with_continuation_timeout do @last_queue_declare_ok = wait_on_continuations end ensure # clear pending continuation context if it belongs to us @pending_queue_declare_name = nil if @pending_queue_declare_name == safe_name end raise_if_continuation_resulted_in_a_channel_error! @last_queue_declare_ok end |