Class: Qpid::Management::Broker
- Inherits:
-
BrokerObject
- Object
- BrokerObject
- Qpid::Management::Broker
- Defined in:
- lib/qpid_management/broker.rb
Overview
Representation of the broker. Properties include:
-
abandoned
-
abandonedViaAlt
-
acquires
-
byteDepth
-
byteFtdDepth
-
byteFtdDequeues
-
byteFtdEnqueues
-
bytePersistDequeues
-
bytePersistEnqueues
-
byteTotalDequeues
-
byteTotalEnqueues
-
byteTxnDequeues
-
byteTxnEnqueues
-
connBacklog
-
dataDir
-
discardsLvq
-
discardsNoRoute
-
discardsOverflow
-
discardsPurge
-
discardsRing
-
discardsSubscriber
-
discardsTtl
-
maxConns
-
mgmtPubInterval
-
mgmtPublish
-
msgDepth
-
msgFtdDepth
-
msgFtdDequeues
-
msgFtdEnqueues
-
msgPersistDequeues
-
msgPersistEnqueues
-
msgTotalDequeues
-
msgTotalEnqueues
-
msgTxnDequeues
-
msgTxnEnqueues
-
name
-
port
-
queueCount
-
releases
-
reroutes
-
stagingThreshold
-
systemRef
-
uptime
-
version
-
workerThreads
Instance Attribute Summary
Attributes inherited from BrokerObject
Class Method Summary collapse
-
.has_many(*collections) ⇒ Object
Adds methods for the specified collections to be able to access all instances of a given collection, as well as a single instance by oid.
-
.has_one(*types) ⇒ Object
Adds method for the specified types to be able to access the singular instance of a given type.
Instance Method Summary collapse
-
#add_binding(exchange, queue, key = "", options = {}) ⇒ Object
Adds a binding from an exchange to a queue.
-
#add_dynamic_route(name, options = {}) ⇒ Object
Adds a dynamic route.
-
#add_exchange(type, name, options = {}) ⇒ Object
Adds an exchange to the broker.
-
#add_exchange_route(name, options = {}) ⇒ Object
Adds an exchange route.
-
#add_link(name, host, port, transport = 'tcp', durable = false, auth_mechanism = "", username = "", password = "") ⇒ Object
Adds a link to a remote broker.
-
#add_queue(name, options = {}) ⇒ Object
Adds a queue to the broker.
-
#add_queue_route(name, options = {}) ⇒ Object
Adds a queue route.
-
#delete_binding(exchange, queue, key = "") ⇒ Object
Deletes a binding from an exchange to a queue.
-
#delete_bridge(name) ⇒ Object
Deletes a bridge (route).
-
#delete_exchange(name) ⇒ Object
Deletes an exchange from the broekr.
-
#delete_link(name) ⇒ Object
Deletes a link to a remote broker.
-
#delete_queue(name) ⇒ Object
Deletes a queue from the broker.
Methods inherited from BrokerObject
#[], #created_at, #deleted_at, #id, #initialize, #invoke_method, #method_missing, qmf_class, #refresh!, #short_id, #to_s, #updated_at
Constructor Details
This class inherits a constructor from Qpid::Management::BrokerObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Qpid::Management::BrokerObject
Class Method Details
.has_many(*collections) ⇒ Object
Adds methods for the specified collections to be able to access all instances of a given collection, as well as a single instance by oid.
Example
has_many :queues
which will add:
-
#queues
to retrieve all queues -
#queue(oid)
to retrieve a queue by oid (note, this is the short form of the object id, e.g. “myqueue” for a queue instead of “org.apache.qpid.broker:queue:myqueue”
78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/qpid_management/broker.rb', line 78 def self.has_many(*collections) [*collections].each do |collection| singular_form = collection.to_s[0..-2] capitalized_type = singular_form.gsub(/^\w/) { $&.upcase } define_method(collection) do @agent.find_all_by_class(Qpid::Management::const_get(capitalized_type)) end define_method(singular_form) do |oid| @agent.find_by_object_id(Qpid::Management::const_get(capitalized_type), "org.apache.qpid.broker:#{singular_form}:#{oid}") end end end |
.has_one(*types) ⇒ Object
Adds method for the specified types to be able to access the singular instance of a given type.
Example
has_one :acl
which will add:
-
#acl
to retrieve the Acl data for the Broker
101 102 103 104 105 106 107 108 109 |
# File 'lib/qpid_management/broker.rb', line 101 def self.has_one(*types) [*types].each do |type| capitalized_type = type.to_s.gsub(/^\w/) { $&.upcase } define_method("#{type}") do @agent.find_first_by_class(Qpid::Management::const_get(capitalized_type)) end end end |
Instance Method Details
#add_binding(exchange, queue, key = "", options = {}) ⇒ Object
Adds a binding from an exchange to a queue
146 147 148 |
# File 'lib/qpid_management/broker.rb', line 146 def add_binding(exchange, queue, key="", ={}) create_broker_object('binding', "#{exchange}/#{queue}/#{key}", ) end |
#add_dynamic_route(name, options = {}) ⇒ Object
Adds a dynamic route
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/qpid_management/broker.rb', line 239 def add_dynamic_route(name, ={}) (, [:link, :exchange, :sync]) properties = { 'link' => [:link], 'src' => [:exchange], 'dest' => [:exchange], 'dynamic' => true, 'sync' => [:sync] } properties['queue'] = [:bridge_queue] if .has_key?(:bridge_queue) create_broker_object('bridge', name, properties) end |
#add_exchange(type, name, options = {}) ⇒ Object
Adds an exchange to the broker
118 119 120 |
# File 'lib/qpid_management/broker.rb', line 118 def add_exchange(type, name, ={}) create_broker_object('exchange', name, .merge!({'exchange-type' => type})) end |
#add_exchange_route(name, options = {}) ⇒ Object
Adds an exchange route
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/qpid_management/broker.rb', line 216 def add_exchange_route(name, ={}) (, [:link, :exchange, :key, :sync]) properties = { 'link' => [:link], 'src' => [:exchange], 'dest' => [:exchange], 'key' => [:key], 'sync' => [:sync] } properties['queue'] = [:bridge_queue] if .has_key?(:bridge_queue) create_broker_object('bridge', name, properties) end |
#add_link(name, host, port, transport = 'tcp', durable = false, auth_mechanism = "", username = "", password = "") ⇒ Object
Adds a link to a remote broker
167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/qpid_management/broker.rb', line 167 def add_link(name, host, port, transport='tcp', durable=false, auth_mechanism="", username="", password="") = { 'host' => host, 'port' => port, 'transport' => transport, 'durable' => durable, 'authMechanism' => auth_mechanism, 'username' => username, 'password' => password } create_broker_object('link', name, ) end |
#add_queue(name, options = {}) ⇒ Object
Adds a queue to the broker
131 132 133 |
# File 'lib/qpid_management/broker.rb', line 131 def add_queue(name, ={}) create_broker_object('queue', name, ) end |
#add_queue_route(name, options = {}) ⇒ Object
Adds a queue route
194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/qpid_management/broker.rb', line 194 def add_queue_route(name, ={}) (, [:link, :queue, :exchange, :sync]) properties = { 'link' => [:link], 'src' => [:queue], 'dest' => [:exchange], 'srcIsQueue' => true, 'sync' => [:sync] } create_broker_object('bridge', name, properties) end |
#delete_binding(exchange, queue, key = "") ⇒ Object
Deletes a binding from an exchange to a queue
154 155 156 |
# File 'lib/qpid_management/broker.rb', line 154 def delete_binding(exchange, queue, key="") invoke_method('delete', {'type' => 'binding', 'name' => "#{exchange}/#{queue}/#{key}"}) end |
#delete_bridge(name) ⇒ Object
Deletes a bridge (route)
257 258 259 |
# File 'lib/qpid_management/broker.rb', line 257 def delete_bridge(name) invoke_method('delete', {'type' => 'bridge', 'name' => name}) end |
#delete_exchange(name) ⇒ Object
Deletes an exchange from the broekr
124 125 126 |
# File 'lib/qpid_management/broker.rb', line 124 def delete_exchange(name) invoke_method('delete', {'type' => 'exchange', 'name' => name}) end |
#delete_link(name) ⇒ Object
Deletes a link to a remote broker
183 184 185 |
# File 'lib/qpid_management/broker.rb', line 183 def delete_link(name) invoke_method('delete', {'type' => 'link', 'name' => name}) end |
#delete_queue(name) ⇒ Object
Deletes a queue from the broker
137 138 139 |
# File 'lib/qpid_management/broker.rb', line 137 def delete_queue(name) invoke_method('delete', {'type' => 'queue', 'name' => name}) end |