Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-1350

Object dereference feature in the QMF Console API

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: M4
    • Fix Version/s: M4
    • Component/s: C++ Broker, Python Client
    • Labels:
      None

      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}

        Attachments

          Activity

            People

            • Assignee:
              tedross Ted Ross
              Reporter:
              tedross Ted Ross
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: