Class: AMQP::Client::Queue
- Inherits:
-
Object
- Object
- AMQP::Client::Queue
- Defined in:
- lib/amqp/client/queue.rb
Overview
Queue abstraction
Instance Method Summary collapse
-
#bind(exchange, binding_key, arguments: {}) ⇒ self
Bind the queue to an exchange.
-
#delete ⇒ nil
Delete the queue.
-
#publish(body, **properties) ⇒ self
Publish to the queue, wait for confirm.
-
#purge ⇒ self
Purge/empty the queue.
-
#subscribe(no_ack: false, prefetch: 1, worker_threads: 1, arguments: {}) {|Message| ... } ⇒ self
Subscribe/consume from the queue.
-
#unbind(exchange, binding_key, arguments: {}) ⇒ self
Unbind the queue from an exchange.
Instance Method Details
#bind(exchange, binding_key, arguments: {}) ⇒ self
Bind the queue to an exchange
42 43 44 45 |
# File 'lib/amqp/client/queue.rb', line 42 def bind(exchange, binding_key, arguments: {}) @client.bind(@name, exchange, binding_key, arguments: arguments) self end |
#delete ⇒ nil
Delete the queue
66 67 68 69 |
# File 'lib/amqp/client/queue.rb', line 66 def delete @client.delete_queue(@name) nil end |
#publish(body, **properties) ⇒ self
Publish to the queue, wait for confirm
19 20 21 22 |
# File 'lib/amqp/client/queue.rb', line 19 def publish(body, **properties) @client.publish(body, "", @name, **properties) self end |
#purge ⇒ self
Purge/empty the queue
59 60 61 62 |
# File 'lib/amqp/client/queue.rb', line 59 def purge @client.purge(@name) self end |
#subscribe(no_ack: false, prefetch: 1, worker_threads: 1, arguments: {}) {|Message| ... } ⇒ self
Subscribe/consume from the queue
32 33 34 35 |
# File 'lib/amqp/client/queue.rb', line 32 def subscribe(no_ack: false, prefetch: 1, worker_threads: 1, arguments: {}, &blk) @client.subscribe(@name, no_ack: no_ack, prefetch: prefetch, worker_threads: worker_threads, arguments: arguments, &blk) self end |
#unbind(exchange, binding_key, arguments: {}) ⇒ self
Unbind the queue from an exchange
52 53 54 55 |
# File 'lib/amqp/client/queue.rb', line 52 def unbind(exchange, binding_key, arguments: {}) @client.unbind(@name, exchange, binding_key, arguments: arguments) self end |