You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by Gordon Sim <gs...@redhat.com> on 2014/06/16 11:08:51 UTC

Breaking change in python client (was Re: svn commit: r1602820 - in /qpid/trunk/qpid/python/qpid/messaging: driver.py endpoints.py)

On 06/16/2014 09:09 AM, pmoravec@apache.org wrote:
> Author: pmoravec
> Date: Mon Jun 16 08:09:42 2014
> New Revision: 1602820
>
> URL: http://svn.apache.org/r1602820
> Log:
> QPID-5823: Python client should create a node with name starting '\#'
>
> Modified:
>      qpid/trunk/qpid/python/qpid/messaging/driver.py
>      qpid/trunk/qpid/python/qpid/messaging/endpoints.py
>

This change breaks the behaviour of the oython client. Previously the 
application could retrieve the name of the source after the expansion of 
the '#' for use in the reply_to. With this change, that no longer works. 
I think we need to revert and look for a different fix.

> Modified: qpid/trunk/qpid/python/qpid/messaging/driver.py
> URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/messaging/driver.py?rev=1602820&r1=1602819&r2=1602820&view=diff
> ==============================================================================
> --- qpid/trunk/qpid/python/qpid/messaging/driver.py (original)
> +++ qpid/trunk/qpid/python/qpid/messaging/driver.py Mon Jun 16 08:09:42 2014
> @@ -34,6 +34,7 @@ from qpid.selector import Selector
>   from qpid.util import URL, default,get_client_properties_with_defaults
>   from qpid.validator import And, Context, List, Map, Types, Values
>   from threading import Condition, Thread
> +from qpid.datatypes import uuid4
>
>   log = getLogger("qpid.messaging")
>   rawlog = getLogger("qpid.messaging.io.raw")
> @@ -941,6 +942,16 @@ class Engine:
>           # XXX: subject
>           if lnk.options is None:
>             lnk.options = {}
> +        # if address starts with '#', create auxiliary queue with name preceded by uuid
> +        if addr.startswith("#") and 'create' not in lnk.options:
> +          lnk.name = str(uuid4()) + lnk.name
> +          lnk.options['create'] = "always"
> +          if 'node' not in lnk.options:
> +            lnk.options['node'] = {}
> +          if 'x-declare' not in lnk.options['node']:
> +            lnk.options['node']['x-declare'] = {}
> +          lnk.options['node']['x-declare']['auto-delete'] = "True"
> +          lnk.options['node']['x-declare']['exclusive'] = "True"
>         except address.LexError, e:
>           return MalformedAddress(text=str(e))
>         except address.ParseError, e:
>
> Modified: qpid/trunk/qpid/python/qpid/messaging/endpoints.py
> URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/messaging/endpoints.py?rev=1602820&r1=1602819&r2=1602820&view=diff
> ==============================================================================
> --- qpid/trunk/qpid/python/qpid/messaging/endpoints.py (original)
> +++ qpid/trunk/qpid/python/qpid/messaging/endpoints.py Mon Jun 16 08:09:42 2014
> @@ -596,7 +596,6 @@ class Session(Endpoint):
>       @rtype: Sender
>       @return: a new Sender for the specified target
>       """
> -    target = _mangle(target)
>       sender = Sender(self, self.next_sender_id, target, options)
>       self.next_sender_id += 1
>       self.senders.append(sender)
> @@ -620,7 +619,6 @@ class Session(Endpoint):
>       @rtype: Receiver
>       @return: a new Receiver for the specified source
>       """
> -    source = _mangle(source)
>       receiver = Receiver(self, self.next_receiver_id, source, options)
>       self.next_receiver_id += 1
>       self.receivers.append(receiver)
> @@ -766,12 +764,6 @@ class Session(Endpoint):
>       finally:
>         self.connection._remove_session(self)
>
> -def _mangle(addr):
> -  if addr and addr.startswith("#"):
> -    return str(uuid4()) + addr
> -  else:
> -    return addr
> -
>   class Sender(Endpoint):
>
>     """
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
> For additional commands, e-mail: commits-help@qpid.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Re: Breaking change in python client (was Re: svn commit: r1602820 - in /qpid/trunk/qpid/python/qpid/messaging: driver.py endpoints.py)

Posted by Pavel Moravec <pm...@redhat.com>.
I apologize for the omission, haven't realized the issue Gordon spotted (thanks!).

Commit reverted already (by r1602832), I will post a review for proper patch.

Pavel


----- Original Message -----
> From: "Gordon Sim" <gs...@redhat.com>
> To: dev@qpid.apache.org, "Pavel Moravec" <pm...@redhat.com>
> Sent: Monday, June 16, 2014 11:08:51 AM
> Subject: Breaking change in python client (was Re: svn commit: r1602820 - in /qpid/trunk/qpid/python/qpid/messaging:
> driver.py endpoints.py)
> 
> On 06/16/2014 09:09 AM, pmoravec@apache.org wrote:
> > Author: pmoravec
> > Date: Mon Jun 16 08:09:42 2014
> > New Revision: 1602820
> >
> > URL: http://svn.apache.org/r1602820
> > Log:
> > QPID-5823: Python client should create a node with name starting '\#'
> >
> > Modified:
> >      qpid/trunk/qpid/python/qpid/messaging/driver.py
> >      qpid/trunk/qpid/python/qpid/messaging/endpoints.py
> >
> 
> This change breaks the behaviour of the oython client. Previously the
> application could retrieve the name of the source after the expansion of
> the '#' for use in the reply_to. With this change, that no longer works.
> I think we need to revert and look for a different fix.
> 
> > Modified: qpid/trunk/qpid/python/qpid/messaging/driver.py
> > URL:
> > http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/messaging/driver.py?rev=1602820&r1=1602819&r2=1602820&view=diff
> > ==============================================================================
> > --- qpid/trunk/qpid/python/qpid/messaging/driver.py (original)
> > +++ qpid/trunk/qpid/python/qpid/messaging/driver.py Mon Jun 16 08:09:42
> > 2014
> > @@ -34,6 +34,7 @@ from qpid.selector import Selector
> >   from qpid.util import URL, default,get_client_properties_with_defaults
> >   from qpid.validator import And, Context, List, Map, Types, Values
> >   from threading import Condition, Thread
> > +from qpid.datatypes import uuid4
> >
> >   log = getLogger("qpid.messaging")
> >   rawlog = getLogger("qpid.messaging.io.raw")
> > @@ -941,6 +942,16 @@ class Engine:
> >           # XXX: subject
> >           if lnk.options is None:
> >             lnk.options = {}
> > +        # if address starts with '#', create auxiliary queue with name
> > preceded by uuid
> > +        if addr.startswith("#") and 'create' not in lnk.options:
> > +          lnk.name = str(uuid4()) + lnk.name
> > +          lnk.options['create'] = "always"
> > +          if 'node' not in lnk.options:
> > +            lnk.options['node'] = {}
> > +          if 'x-declare' not in lnk.options['node']:
> > +            lnk.options['node']['x-declare'] = {}
> > +          lnk.options['node']['x-declare']['auto-delete'] = "True"
> > +          lnk.options['node']['x-declare']['exclusive'] = "True"
> >         except address.LexError, e:
> >           return MalformedAddress(text=str(e))
> >         except address.ParseError, e:
> >
> > Modified: qpid/trunk/qpid/python/qpid/messaging/endpoints.py
> > URL:
> > http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/messaging/endpoints.py?rev=1602820&r1=1602819&r2=1602820&view=diff
> > ==============================================================================
> > --- qpid/trunk/qpid/python/qpid/messaging/endpoints.py (original)
> > +++ qpid/trunk/qpid/python/qpid/messaging/endpoints.py Mon Jun 16 08:09:42
> > 2014
> > @@ -596,7 +596,6 @@ class Session(Endpoint):
> >       @rtype: Sender
> >       @return: a new Sender for the specified target
> >       """
> > -    target = _mangle(target)
> >       sender = Sender(self, self.next_sender_id, target, options)
> >       self.next_sender_id += 1
> >       self.senders.append(sender)
> > @@ -620,7 +619,6 @@ class Session(Endpoint):
> >       @rtype: Receiver
> >       @return: a new Receiver for the specified source
> >       """
> > -    source = _mangle(source)
> >       receiver = Receiver(self, self.next_receiver_id, source, options)
> >       self.next_receiver_id += 1
> >       self.receivers.append(receiver)
> > @@ -766,12 +764,6 @@ class Session(Endpoint):
> >       finally:
> >         self.connection._remove_session(self)
> >
> > -def _mangle(addr):
> > -  if addr and addr.startswith("#"):
> > -    return str(uuid4()) + addr
> > -  else:
> > -    return addr
> > -
> >   class Sender(Endpoint):
> >
> >     """
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
> > For additional commands, e-mail: commits-help@qpid.apache.org
> >
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
> For additional commands, e-mail: dev-help@qpid.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org