qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Conway" <acon...@redhat.com>
Subject Re: Review Request 22630: [QPID-5823]: Python client should create a node with name starting '#'
Date Wed, 02 Jul 2014 14:09:25 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/22630/#review47188
-----------------------------------------------------------


How about this (I love python):

class MangledString(str): pass

def _mangle(s): return MangledString(do_mangle(s))

if isinstance(s, MangledString): treat_as_mangled(s)
else: treat_as_unmangled(s)

That way there's no need for extra mangled parameter, no change to existing APIS. No change
to existing code that expects source/target to be a string (since MangledString inherits from
str), only the code that cares about mangled/vs. unmangled ever needs to know.
  

- Alan Conway


On June 16, 2014, 12:35 p.m., Pavel Moravec wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/22630/
> -----------------------------------------------------------
> 
> (Updated June 16, 2014, 12:35 p.m.)
> 
> 
> Review request for qpid, Alan Conway, Gordon Sim, Kenneth Giusti, and Rafael Schloming.
> 
> 
> Bugs: QPID-5823
>     https://issues.apache.org/jira/browse/QPID-5823
> 
> 
> Repository: qpid
> 
> 
> Description
> -------
> 
> The easiest "solution" would be to do the "mangling" in parse_address method in driver.py
(see original https://svn.apache.org/r1602820 I reverted). That prevents any application to
get proper node address ('#' expanded).
> 
> So the '#' expansion needs to be done in endpoints.py and the information "address is
expanded" needs to be passed to parse_address method. Either using [Sender|Receiver].mangled
boolean (like in attached patch) or Sender.target / Receiver.source could be a double (address_string,
mangled), like _mangle method returns in the patch. I don't know what approach (or some combination)
is better.
> 
> 
> FYI C++ client has similar code:
> 
>     if (qpid::messaging::AddressImpl::isTemporary(a) && createPolicy.isVoid())
{
>         createPolicy = "always";
>         Opt specified = Opt(a)/NODE/X_DECLARE;
>         if (!specified.hasKey(AUTO_DELETE)) autoDelete = true;
>         if (!specified.hasKey(EXCLUSIVE)) exclusive = true;
>     }
> 
> where isTemporary(a)==true iff node name starts with '#'.
> 
> 
> Diffs
> -----
> 
>   /trunk/qpid/python/qpid/messaging/driver.py 1602841 
>   /trunk/qpid/python/qpid/messaging/endpoints.py 1602841 
> 
> Diff: https://reviews.apache.org/r/22630/diff/
> 
> 
> Testing
> -------
> 
> Automated tests passed.
> 
> Manual test passed as well:
> 
> $ drain "#q; {node: {durable:true}}" -t 2 & qpid-stat -q
> [1] 25174
> c17af530-6cd8-462d-b8e8-5e4b6c9d50f8#q; {node: {durable:true}}
> Queues
>   queue                                     dur  autoDel  excl  msg   msgIn  msgOut 
bytes  bytesIn  bytesOut  cons  bind
>   =========================================================================================================================
>   af192c4d-b2a0-47c3-8dd4-e99f400da51d:0.0       Y        Y        0     0      0   
   0      0        0         1     2
>   c17af530-6cd8-462d-b8e8-5e4b6c9d50f8#q    Y    Y        Y        0     0      0   
   0      0        0         1     1
> $
> 
> (the same for spout)
> 
> receiver / producer is able to print expanded address (see the "c17af530-6cd8-462d-b8e8-5e4b6c9d50f8#q;
{node: {durable:true}}" line).
> 
> 
> Thanks,
> 
> Pavel Moravec
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message