You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Wolgemuth Greg <wo...@eseri.com> on 2010/10/07 19:57:02 UTC

Difficulties with QMFv2 Python bindings

I'm working with a build from SVN trunk, and am trying to use the Python
QMFv2 bindings. I've been starting with the example provided (agent.py),
and then moving on to try and get a functional console, but have had
some difficulties.

First, the agent example as provided fails to function correctly, and
outputs the following:

2010-10-07 21:52:22 warning Exception received from broker: not-found:
not-found: Queue not found: qmf.default.direct
(qpid/broker/SessionAdapter.cpp:752) [caused by 2 \x08:\x01]
Traceback (most recent call last):
  File "./example_agent.py", line 145, in <module>
    agent = ExampleAgent("fed1.lab.eseri.net")
  File "./example_agent.py", line 47, in __init__
    self.session.open()
  File "/usr/lib/python2.6/site-packages/qmf2.py", line 229, in open
    self._impl.open()
  File "/usr/lib/python2.6/site-packages/cqmf2.py", line 246, in open
    def open(self): return _cqmf2.AgentSession_open(self)
RuntimeError: Queue qmf.default.direct does not exist
Segmentation fault

I've tried looking through the qmf2.py source to understand how to
create a Console, and came up with this as a simple proof of concept:

import cqpid
from qmf2 import *

connection = cqpid.Connection("fed1.lab.eseri.net")
connection.open()

myconsole = ConsoleSession(connection)
myconsole.open()
print myconsole.getAgents()

When run, it outputs the following:

2010-10-07 21:50:15 warning Exception received from broker: not-found:
not-found: Exchange not found: qmf.default.direct
(qpid/broker/ExchangeRegistry.cpp:90) [caused by 2 \x07:\x01]
Traceback (most recent call last):
  File "./console.py", line 24, in <module>
    myconsole.open()
  File "/usr/lib/python2.6/site-packages/qmf2.py", line 166, in open
    self._impl.open()
  File "/usr/lib/python2.6/site-packages/cqmf2.py", line 314, in open
    def open(self): return _cqmf2.ConsoleSession_open(self)
RuntimeError: Exchange qmf.default.direct does not exist

I found that by using the messaging library, I can create the
"qmf.default.direct" and "qmf.default.topic" exchanges by hand before
opening the console session, and the console appears to work (although
getAgents never returns any values)

However, if I then run the agent example, with the qmf exchanges created
by the console, I get this output instead:

./example_agent.py 
Traceback (most recent call last):
  File "./example_agent.py", line 145, in <module>
    agent = ExampleAgent("broker.example.org")
  File "./example_agent.py", line 47, in __init__
    self.session.open()
  File "/usr/lib/python2.6/site-packages/qmf2.py", line 229, in open
    self._impl.open()
  File "/usr/lib/python2.6/site-packages/cqmf2.py", line 246, in open
    def open(self): return _cqmf2.AgentSession_open(self)
RuntimeError: Ambiguous address, please specify queue or topic as node
type
Segmentation fault

It seems like my difficulties are centred around not having the
qmf.default.* exchanges set up correctly. Am I wrong in thinking that
the QMF libraries ought to be declaring/asserting these exchanges
automatically, the same way the QMF queues are created? If not, I'd
appreciate a couple of lines I could use with the messaging API to
create the exchanges with the correct options/settings.

Greg


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Difficulties with QMFv2 Python bindings

Posted by Wolgemuth Greg <wo...@eseri.com>.
On Thu, 2010-10-07 at 17:36 -0400, Ted Ross wrote:
> >    
> I believe that this is caused by there being both an exchange *and* a 
> queue named qmf.default.direct.  I checked in a fix to handle this 
> ambiguity in revision 1005643.
> 
> -Ted
> 
> 
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
> 
> 

Thanks Ted, I am using the 0.6 broker implementation, I'll update that
to be a trunk build instead and see where I can go from there.

Greg


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Difficulties with QMFv2 Python bindings

Posted by Ted Ross <tr...@redhat.com>.
On 10/07/2010 01:57 PM, Wolgemuth Greg wrote:
> I'm working with a build from SVN trunk, and am trying to use the Python
> QMFv2 bindings. I've been starting with the example provided (agent.py),
> and then moving on to try and get a functional console, but have had
> some difficulties.
>
> First, the agent example as provided fails to function correctly, and
> outputs the following:
>
> 2010-10-07 21:52:22 warning Exception received from broker: not-found:
> not-found: Queue not found: qmf.default.direct
> (qpid/broker/SessionAdapter.cpp:752) [caused by 2 \x08:\x01]
> Traceback (most recent call last):
>    File "./example_agent.py", line 145, in<module>
>      agent = ExampleAgent("fed1.lab.eseri.net")
>    File "./example_agent.py", line 47, in __init__
>      self.session.open()
>    File "/usr/lib/python2.6/site-packages/qmf2.py", line 229, in open
>      self._impl.open()
>    File "/usr/lib/python2.6/site-packages/cqmf2.py", line 246, in open
>      def open(self): return _cqmf2.AgentSession_open(self)
> RuntimeError: Queue qmf.default.direct does not exist
> Segmentation fault
>
> I've tried looking through the qmf2.py source to understand how to
> create a Console, and came up with this as a simple proof of concept:
>
> import cqpid
> from qmf2 import *
>
> connection = cqpid.Connection("fed1.lab.eseri.net")
> connection.open()
>
> myconsole = ConsoleSession(connection)
> myconsole.open()
> print myconsole.getAgents()
>
> When run, it outputs the following:
>
> 2010-10-07 21:50:15 warning Exception received from broker: not-found:
> not-found: Exchange not found: qmf.default.direct
> (qpid/broker/ExchangeRegistry.cpp:90) [caused by 2 \x07:\x01]
> Traceback (most recent call last):
>    File "./console.py", line 24, in<module>
>      myconsole.open()
>    File "/usr/lib/python2.6/site-packages/qmf2.py", line 166, in open
>      self._impl.open()
>    File "/usr/lib/python2.6/site-packages/cqmf2.py", line 314, in open
>      def open(self): return _cqmf2.ConsoleSession_open(self)
> RuntimeError: Exchange qmf.default.direct does not exist
>
> I found that by using the messaging library, I can create the
> "qmf.default.direct" and "qmf.default.topic" exchanges by hand before
> opening the console session, and the console appears to work (although
> getAgents never returns any values)
>    
I would guess that you are not running the broker from the trunk because 
the trunk broker creates those two exchanges at startup.  In any case, 
the exchanges can be set up simply using qpid-config:

$ qpid-config add exchange direct qmf.default.direct
$ qpid-config add exchange topic qmf.default.topic

This is also the reason that getAgents doesn't return any results.  
There are no agents to detect since the console is the only client bound 
to the qmf exchanges.  The trunk broker will register a QMFv2 agent (for 
managing the broker).
> However, if I then run the agent example, with the qmf exchanges created
> by the console, I get this output instead:
>
> ./example_agent.py
> Traceback (most recent call last):
>    File "./example_agent.py", line 145, in<module>
>      agent = ExampleAgent("broker.example.org")
>    File "./example_agent.py", line 47, in __init__
>      self.session.open()
>    File "/usr/lib/python2.6/site-packages/qmf2.py", line 229, in open
>      self._impl.open()
>    File "/usr/lib/python2.6/site-packages/cqmf2.py", line 246, in open
>      def open(self): return _cqmf2.AgentSession_open(self)
> RuntimeError: Ambiguous address, please specify queue or topic as node
> type
> Segmentation fault
>    
I believe that this is caused by there being both an exchange *and* a 
queue named qmf.default.direct.  I checked in a fix to handle this 
ambiguity in revision 1005643.

-Ted


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org