[ 
https://issues.apache.org/jira/browse/QPID-1350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639878#action_12639878
 ] 

Ted Ross commented on QPID-1350:
--------------------------------

There's a problem with this feature in that there is no way *not* to 
dereference reference values.  Some applications want to get the reference for 
comparison purposes and not dereference to the referenced object.

To fix this problem, I've changed the syntax for dereferencing so it is 
optional.  From the example above, to get the objectId (not dereferenced) use:

vhostId = queue.vhostRef

To follow the reference to the vhost object:

vhostObj = queue._vhostRef_

I will edit the example in the main text above to reflect this new reality.

-Ted


> 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, '/')]
> 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