...
Viewing Properties and Statistics of an Object
Let us now focus our attention on one of the queue objects.
No Format |
---|
>>> queue = queues[0]
|
The attributes of an object are partitioned into properties and statistics. Though the distinction is somewhat arbitrary, properties tend to be fairly static and may also be large and statistics tend to change rapidly and are relatively small (counters, etc.).
There are two ways to view the properties of an object. An array of properties can be obtained using the getProperties function:
No Format |
---|
>>> props = queue.getProperties()
>>> for prop in props:
... print prop
...
(vhostRef, 0-0-1-0-1152921504606846979)
(name, u'reply-localhost.localdomain.32004')
(durable, False)
(autoDelete, True)
(exclusive, True)
(arguments, {})
>>>
|
The getProperties function returns an array of tuples. Each tuple consists of the property descriptor and the property value.
A more convenient way to access properties is by using the attribute of the proxy object directly:
No Format |
---|
>>> queue.autoDelete
True
>>> queue.name
u'reply-localhost.localdomain.32004'
>>>
|
Statistics are accessed in the same way:
No Format |
---|
>>> stats = queue.getStatistics()
>>> for stat in stats:
... print stat
...
(msgTotalEnqueues, 53)
(msgTotalDequeues, 53)
(msgTxnEnqueues, 0)
(msgTxnDequeues, 0)
(msgPersistEnqueues, 0)
(msgPersistDequeues, 0)
(msgDepth, 0)
(byteDepth, 0)
(byteTotalEnqueues, 19116)
(byteTotalDequeues, 19116)
(byteTxnEnqueues, 0)
(byteTxnDequeues, 0)
(bytePersistEnqueues, 0)
(bytePersistDequeues, 0)
(consumerCount, 1)
(consumerCountHigh, 1)
(consumerCountLow, 1)
(bindingCount, 2)
(bindingCountHigh, 2)
(bindingCountLow, 2)
(unackedMessages, 0)
(unackedMessagesHigh, 0)
(unackedMessagesLow, 0)
(messageLatencySamples, 0)
(messageLatencyMin, 0)
(messageLatencyMax, 0)
(messageLatencyAverage, 0)
>>>
|
or alternatively:
No Format |
---|
>>> queue.byteTotalEnqueues
19116
>>>
|
Invoking Methods on an Object
...