[ 
https://issues.apache.org/jira/browse/QPID-1350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ted Ross updated QPID-1350:
---------------------------

    Description: 
This new feature lets users of the Python QMF API easily follow references in 
objects.

For example:

Start a QMF console session and connect to the broker on the local host:

>>> s = Session()
>>> b = s.addBroker()


Get the first in the list of queue objects:

>>> queue = s.getObjects(_class="queue")[0]


Look at the queue's properties:

>>> queue.getProperties()
[(vhostRef, 0-0-1-0-1152921504606846979), (name, 
'reply-kids-pc.localdomain.19302'), (durable, False), (autoDelete, True), 
(exclusive, True), (arguments, {})]


Note that the vhostRef is an objectId.  Now there's a very easy way to get the 
referenced vhost object:

>>> vhost = queue._vhostRef_
>>> vhost.getProperties()
[(brokerRef, 0-0-1-0-1152921504606846978), (name, '/')]

Note the "_" added before and after the property name.  Without the 
underscores, the value returned will be simply the objectId.  With the 
underscores, the reference will be followed and the referenced object returned.


Likewise, we can get the broker object:

>>> queue._vhostRef_._brokerRef_.getProperties()
[(systemRef, 0-0-1-0-1152921504606846977), (port, 5672), (workerThreads, 5), 
(maxConns, 500), (connBacklog, 10), (stagingThreshold, 5000000), 
(mgmtPubInterval, 10), (version, '0.3'), (dataDir, '/home/ross/.qpidd')]


Or even invoke a method on the broker:

>>> queue._vhostRef_._brokerRef_.echo(1,"text")
OK (0) - {'body': u'text', 'sequence': 1}



  was:
This new feature lets users of the Python QMF API easily follow references in 
objects.

For example:

Start a QMF console session and connect to the broker on the local host:

>>> s = Session()
>>> b = s.addBroker()


Get the first in the list of queue objects:

>>> queue = s.getObjects(_class="queue")[0]


Look at the queue's properties:

>>> queue.getProperties()
[(vhostRef, 0-0-1-0-1152921504606846979), (name, 
'reply-kids-pc.localdomain.19302'), (durable, False), (autoDelete, True), 
(exclusive, True), (arguments, {})]


Note that the vhostRef is an objectId.  Now there's a very easy way to get the 
referenced vhost object:

>>> vhost = queue.vhostRef
>>> vhost.getProperties()
[(brokerRef, 0-0-1-0-1152921504606846978), (name, '/')]


Likewise, we can get the broker object:

>>> queue.vhostRef.brokerRef.getProperties()
[(systemRef, 0-0-1-0-1152921504606846977), (port, 5672), (workerThreads, 5), 
(maxConns, 500), (connBacklog, 10), (stagingThreshold, 5000000), 
(mgmtPubInterval, 10), (version, '0.3'), (dataDir, '/home/ross/.qpidd')]


Or even invoke a method on the broker:

>>> queue.vhostRef.brokerRef.echo(1,"text")
OK (0) - {'body': u'text', 'sequence': 1}




> Object dereference feature in the QMF Console API
> -------------------------------------------------
>
>                 Key: QPID-1350
>                 URL: https://issues.apache.org/jira/browse/QPID-1350
>             Project: Qpid
>          Issue Type: New Feature
>          Components: C++ Broker, Python Client
>    Affects Versions: M4
>            Reporter: Ted Ross
>            Assignee: Ted Ross
>            Priority: Minor
>             Fix For: M4
>
>
> This new feature lets users of the Python QMF API easily follow references in 
> objects.
> For example:
> Start a QMF console session and connect to the broker on the local host:
> >>> s = Session()
> >>> b = s.addBroker()
> Get the first in the list of queue objects:
> >>> queue = s.getObjects(_class="queue")[0]
> Look at the queue's properties:
> >>> queue.getProperties()
> [(vhostRef, 0-0-1-0-1152921504606846979), (name, 
> 'reply-kids-pc.localdomain.19302'), (durable, False), (autoDelete, True), 
> (exclusive, True), (arguments, {})]
> Note that the vhostRef is an objectId.  Now there's a very easy way to get 
> the referenced vhost object:
> >>> vhost = queue._vhostRef_
> >>> vhost.getProperties()
> [(brokerRef, 0-0-1-0-1152921504606846978), (name, '/')]
> Note the "_" added before and after the property name.  Without the 
> underscores, the value returned will be simply the objectId.  With the 
> underscores, the reference will be followed and the referenced object 
> returned.
> Likewise, we can get the broker object:
> >>> queue._vhostRef_._brokerRef_.getProperties()
> [(systemRef, 0-0-1-0-1152921504606846977), (port, 5672), (workerThreads, 5), 
> (maxConns, 500), (connBacklog, 10), (stagingThreshold, 5000000), 
> (mgmtPubInterval, 10), (version, '0.3'), (dataDir, '/home/ross/.qpidd')]
> Or even invoke a method on the broker:
> >>> queue._vhostRef_._brokerRef_.echo(1,"text")
> OK (0) - {'body': u'text', 'sequence': 1}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to