Thanks for the code snippet, I understand what is happening now. The tilde
syntax (~) in the address is telling the messenger object to bind to the
local host/port. Doing this from two separate processes on the same host
(or indeed using two separate Messenger objects within a single process)
will result in those two attempts to bind to that same host/port and
consequently the second one will produce the error you're seeing.

Putting incoming/outgoing on separate ports should make the problem go away.

To answer your first question from earlier in the thread, you can use as
many different addresses as you like with a single Messenger, e.g. you can
subscribe to "amqp://~localhost:8888" and you will receive messages sent to
any destination. You can check the address on the incoming message to see
where it was sent. You simply can't do this from multiple processes on the
same host/port with the ~ syntax as that will result in multiple attempts
to bind to the same port. You *could* do this without the twiddle syntax if
you were to stick an intermediary in between. The currently available AMQP
1.0 intermediaries being the qpid cpp and java brokers, active mq, windows
azure service bus, swift mq, and possibly some more I'm forgetting.

To answer your second question about configuration, as I mentioned in a
previous thread, there are plans to develop a very flexible lightweight
intermediary that will be deployable alongside or even embedded in
Messenger that will provide a more seamless experience here, and that would
likely provide some optional configuration capabilities.

--Rafael

On Thu, Jan 17, 2013 at 12:08 PM, Eagy, Taylor <te...@blackbirdtech.com>wrote:

> One of my processes creates an instance of the Messenger to listen for
> incoming messages:
>
>
>
> self.messenger = Messenger()
>
> self.messenger.timeout = timeout
>
> self.messenger.subscribe('amqp://~localhost:8888/incoming')
>
> self.messenger.start()
>
> msg = Message()
>
> reply = Message()
>
> while True:
>
>     if self.messenger.incoming < 10:
>
>         self.messenger.recv(10)
>
>     if self.messenger.incoming > 0:
>
>         self.messenger.get(msg)
>
>         if msg.reply_to:
>
>             reply.address = msg.reply_to
>
>             reply.correlation_id = msg.correlation_id
>
>             reply.body = msg.body
>
>             reply.durable = True
>
>        self.messenger.put(reply)
>
>        self.messenger.send()
>
>
>
> I have another Python process that does the same thing except the only
> difference is the subscribe line:
>
>
>
> self.messenger.subscribe('amqp://~localhost:8888/outgoing')
>
>
>
> And then I have another process that tries to connect to the incoming
> queue and send a message:
>
>
>
> self.messenger = Messenger()
>
> self.messenger.start()
>
> msg = Message()
>
> msg.address = self.address
>
> msg.body = data
>
> msg.properties = props
>
> msg.durable = True
>
> self.messenger.put(msg)
>
> self.messenger.send()
>
>
>
> Thanks,
>
> Taylor
>
>
>
>
>
> ________________________________
> From: Rafael Schloming [r...@alum.mit.edu]
> Sent: Thursday, January 17, 2013 11:10 AM
> To: proton@qpid.apache.org
> Subject: Re: Subscribing to multiple queue names on the same host/port
>
> On Thu, Jan 17, 2013 at 10:06 AM, Eagy, Taylor <te...@blackbirdtech.com
> >wrote:
>
> > One of the nice things I liked about the Java Qpid broker was that you
> > could create multiple queues bound on the same host:port using the
> > virutualhosts.xml config. When I try subscribing to
> > amqp://localhost:8888/incoming and amqp://localhost:8888/outgoing, it
> > complains that the address is already in use. Does the Messenger API
> > support multiple queues per host:port? Also are there any plans for
> Proton
> > to load config file similar to the Qpid brokers?
> >
>
> Can you post a code snippet of what you're trying to do?
>
> --Rafael
>

Reply via email to