On Mon, 2019-12-09 at 14:34 +0000, Bourne, Mark wrote:
> ...
> Thanks for the quick confirmation and suggestions.
>
> As far as I can see from the API documentation, it looks like
> Connection.connect_address was only added in version 0.28.0 - is that
> correct?
Yes, that is correct.
> We may need to still support older versions for a while until
> everyone's repositories are updated (until last week ours was still
> on 0.26.0), but should be able to use Connection.connect_address fall
> back to Reactor.get_connection_address() if that's not available.
That will work as the API is only deprecated for the moment and still
present.
>
> A slight difference from previous behaviour is that
> Connection.connect_address adds the 'amqp://' protocol to the URL if
> it wasn't specified when creating the connection, whereas
> Reactor.get_connection_address() previously didn't. e.g. if the
> connection was created with '1.2.3.4:5672' as the URL, the older
> Reactor.get_connection_address() returned that exact same string,
> whereas Connection.connect_address now gives
> 'amqp://1.2.3.4:5672'. It looks like we should be able to use
> something like str(proton.Url('1.2.3.4:5672')) to get a consistent
> form for comparisons, which would probably be more reliable anyway,
> so shouldn't be a big issue. Just thought it might be worth
> mentioning, since it looks like the fixed
> Reactor.get_connection_address() just returns
> connection.connected_address so will now also add the protocol.
I think previously you would get exactly the string that you passed in,
whereas I think now the string gets normalised to a URL with defaults
filled in then converted back to a string (I haven't checked the exact
code path though). This change in behaviour is not likely to change as
the underlying implementation is entirely different now from before.
As you note comparing the URL may be more reliable if you need to check
whether URLs are the same. You may be able to compare proton.URL types
directly rather than have to convert them back to str for comparisons
(again I've not actually checked the code though it would make sense).
Andrew
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]