Class: AMQP::Client::Exchange
- Inherits:
-
Object
- Object
- AMQP::Client::Exchange
- Defined in:
- lib/amqp/client/exchange.rb
Overview
High level representation of an exchange
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#bind(source, binding_key = "", arguments: {}) ⇒ Exchange
Bind to another exchange.
-
#delete ⇒ nil
Delete the exchange.
-
#publish(body, routing_key = "", **properties) ⇒ Exchange
Publish to the exchange.
-
#unbind(source, binding_key = "", arguments: {}) ⇒ Exchange
Unbind from another exchange.
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/amqp/client/exchange.rb', line 7 def name @name end |
Instance Method Details
#bind(source, binding_key = "", arguments: {}) ⇒ Exchange
Bind to another exchange
45 46 47 48 49 |
# File 'lib/amqp/client/exchange.rb', line 45 def bind(source, binding_key = "", arguments: {}) source = source.name unless source.is_a?(String) @client.exchange_bind(@name, source, binding_key, arguments:) self end |
#delete ⇒ nil
Delete the exchange
64 65 66 67 |
# File 'lib/amqp/client/exchange.rb', line 64 def delete @client.delete_exchange(@name) nil end |
#publish(body, routing_key = "", **properties) ⇒ Exchange
Publish to the exchange
35 36 37 38 |
# File 'lib/amqp/client/exchange.rb', line 35 def publish(body, routing_key = "", **properties) @client.publish(body, @name, routing_key, **properties) self end |
#unbind(source, binding_key = "", arguments: {}) ⇒ Exchange
Unbind from another exchange
56 57 58 59 60 |
# File 'lib/amqp/client/exchange.rb', line 56 def unbind(source, binding_key = "", arguments: {}) source = source.name unless source.is_a?(String) @client.exchange_unbind(@name, source, binding_key, arguments:) self end |