On Fri, Sep 26, 2014 at 12:51 PM, Fraser Adams < fraser.ad...@blueyonder.co.uk> wrote:
> pn_subscription_address returns the source address of a subscription as a > string when a subscription is successfully made. > > Well rather, it should. > > If I were to subscribe to a node on a broker it seems to work fine, that > is to say if I have an address of say: > > localhost/test > > where test is a queue called test, then it works fine. Even if I do > > localhost/# > > A call to pn_subscription_address will contain the whole address including > the dynamic node name once the broker has created the queue. > > In my case I'm using non-blocking code and pn_subscription_address will > get called several times in my notifier, initially returning NULL but > eventually returning the information I want. > > So far so good, but if I have an address of say: > > amqp://~0.0.0.0 > > or even say > > amqp://~0.0.0.0/test > > I never get a non-NULL address. > > > It's actually quite useful to be able to identify that Messenger has > successfully created a subscription, especially for asynchronous code. I've > used it in code connecting to a broker to actually start doing something > useful on a dynamic queue but for peer-peer code I can't do the same. > > Perhaps with amqp://~0.0.0.0 I can assume that they have been immediately > created? Is that a safe assumption? > Technically the bind can fail if there is another process bound to the port, so strictly speaking that isn't a valid assumption. --Rafael