You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by To...@deutsche-boerse.com on 2011/08/25 10:57:13 UTC

C++ and Python client diferences

Hi,

I am using qpid 13.0 API (from apache SVN) to build my C++ client and I 
have came across this interesting difference when compared to Python 
client.

So for Python I am using this address:

response/response.QPID_CLIENT.response_queue_1;
{
  create: receiver,
  link:
  {
    name: 'response.QPID_CLIENT.response_queue_1',
    durable: false,
    x-declare:
    {
      auto-delete: true,
      exclusive: true,
      arguments:
      {
        'qpid.max_count': 1000,
        'qpid.max_size': 1000000,
        'qpid.policy_type': ring
      }
    }
  }
}


But for C++ client the address had to be modified to:

response/response.QPID_CLIENT.response_queue_1;
{
  assert: never,
  create: never,
  node :
  {
    type: topic
  },
  link:
  {
    name: 'response.QPID_CLIENT.response_queue_1',
    durable: false,
    x-declare:
    {
      auto-delete: true,
      exclusive: true,
      arguments:
      {
        'qpid.max_count': 1000,
        'qpid.max_size': 1000000,
        'qpid.policy_type': ring
      }
    }
  }
}


And I had to add two ACL rules:

acl allow members create exchange name=response passive=true
acl allow QPID_CLIENT@QPID9999 create  queue name=response.QPID_CLIENT.* 
passive=true


Can someone please explain me this difference? Is this expected behavior?

Thanks,

Tomas Soltys



----------------------------------------------------------------------------
Deutsche Börse Services s.r.o.
Managing Directors/Geschäftsführung:
Michael Gassmann, Mats Andersson.
Limited liability company with registered office at
Sokolovská 662/136B, CZ-186 00 Prague 8
recorded in the Commercial Register IC: 275 77 015.
Maintained by the city court in Prague,
Sec. C, File No. 116874.
-----------------------------------------
Diese E-Mail enthaelt vertrauliche oder rechtlich geschuetzte Informationen.
Wenn Sie nicht der beabsichtigte Empfaenger sind, informieren Sie bitte
sofort den Absender und loeschen Sie diese E-Mail. Das unbefugte Kopieren
dieser E-Mail oder die unbefugte Weitergabe der enthaltenen Informationen
ist nicht gestattet.

The information contained in this message is confidential or protected by
law. If you are not the intended recipient, please contact the sender and
delete this message. Any unauthorised copying of this message or
unauthorised distribution of the information contained herein is prohibited.

Legally required information for business correspondence/
Gesetzliche Pflichtangaben fuer Geschaeftskorrespondenz:
http://deutsche-boerse.com/letterhead

Re: C++ and Python client diferences

Posted by Gordon Sim <gs...@redhat.com>.
On 08/26/2011 12:38 PM, Tomas.Soltys@deutsche-boerse.com wrote:
> Ok than.
>
> So is this an expected behaviour or should I raise a JIRA.

Raise a JIRA, it would be much better if the clients behaved the same 
and did not require different ACL rules.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: C++ and Python client diferences

Posted by To...@deutsche-boerse.com.
Ok than.

So is this an expected behaviour or should I raise a JIRA.

Thanks,
Tomas




Gordon Sim <gs...@redhat.com> 
26/08/2011 13:14
Please respond to
users@qpid.apache.org


To
users@qpid.apache.org
cc

Subject
Re: C++ and Python client diferences







On 08/26/2011 11:24 AM, Tomas.Soltys@deutsche-boerse.com wrote:
> Hi Gordon,
>
> Thank you for your reply.
> But there is still one thing I do not understand.
>
> I have set the log level to trace+ on my broker and here is what I got
> from the log when I have used the same same addres for python as well as
> for c++ client.
>
> Python:
>
> 2011-08-26 12:13:08 trace
> QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 0:
> {ExchangeQueryBody: name=response; }
> 2011-08-26 12:13:08 trace
> QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 1:
> {QueueQueryBody: queue=response; }
> 2011-08-26 12:13:08 trace
> QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 2:
> {QueueDeclareBody: queue=response.QPID_CLIENT.response_queue_1;
> exclusive=1; auto-delete=1;
> 
arguments={qpid.max_count:F8:int64(1000),qpid.max_size:F8:int64(1000000),qpid.policy_type:V2:4:str16(ring)};
> }
> 2011-08-26 12:13:08 trace
> QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 3:
> {ExchangeBindBody: queue=response.QPID_CLIENT.response_queue_1;
> exchange=response; binding-key=response.QPID_CLIENT.response_queue_1; }
> 2011-08-26 12:13:08 trace
> QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 4:
> {MessageSubscribeBody: queue=response.QPID_CLIENT.response_queue_1;
> destination=0; accept-mode=0; acquire-mode=0; }
> 2011-08-26 12:13:08 trace
> QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 5:
> {MessageSetFlowModeBody: destination=0; flow-mode=0; }
> 2011-08-26 12:13:08 trace
> QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 6:
> {MessageCancelBody: destination=0; }
> 2011-08-26 12:13:08 trace
> QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 7:
> {QueueDeleteBody: queue=response.QPID_CLIENT.response_queue_1; }
>
> C++:
>
> 2011-08-26 12:15:48 trace
> QPID_CLIENT@QPID9999.a167bd61-8aa3-4900-9ee7-a646bf3c1c63: recv cmd 0:
> {ExecutionSyncBody: }
> 2011-08-26 12:15:48 trace
> QPID_CLIENT@QPID9999.a167bd61-8aa3-4900-9ee7-a646bf3c1c63: recv cmd 1:
> {ExchangeQueryBody: name=response; }
> 2011-08-26 12:15:48 trace
> QPID_CLIENT@QPID9999.a167bd61-8aa3-4900-9ee7-a646bf3c1c63: recv cmd 2:
> {ExchangeDeclareBody: exchange=response; type=topic; 
alternate-exchange=;
> arguments={}; }
>
> C++ client will get 'ACL denied exchange declare request from
> QPID_CLIENT@QPID9999' from the broker. So to make the C++ client to be
> able to pass through I had to adapt the ACL rules and change the adress 
as
> stated in my previous email.

Right, the c++ client will issue a declare for the exchange when 
creating a sender or receiver. If 'create' is not enabled the passive 
flag will be true.

The python client doesn't issue this declare, hence the difference in 
ACL rules required at present.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org






----------------------------------------------------------------------------
Deutsche Börse Services s.r.o.
Managing Directors/Geschäftsführung:
Michael Gassmann, Mats Andersson.
Limited liability company with registered office at
Sokolovská 662/136B, CZ-186 00 Prague 8
recorded in the Commercial Register IC: 275 77 015.
Maintained by the city court in Prague,
Sec. C, File No. 116874.
-----------------------------------------
Diese E-Mail enthaelt vertrauliche oder rechtlich geschuetzte Informationen.
Wenn Sie nicht der beabsichtigte Empfaenger sind, informieren Sie bitte
sofort den Absender und loeschen Sie diese E-Mail. Das unbefugte Kopieren
dieser E-Mail oder die unbefugte Weitergabe der enthaltenen Informationen
ist nicht gestattet.

The information contained in this message is confidential or protected by
law. If you are not the intended recipient, please contact the sender and
delete this message. Any unauthorised copying of this message or
unauthorised distribution of the information contained herein is prohibited.

Legally required information for business correspondence/
Gesetzliche Pflichtangaben fuer Geschaeftskorrespondenz:
http://deutsche-boerse.com/letterhead

Re: C++ and Python client diferences

Posted by Gordon Sim <gs...@redhat.com>.
On 08/26/2011 11:24 AM, Tomas.Soltys@deutsche-boerse.com wrote:
> Hi Gordon,
>
> Thank you for your reply.
> But there is still one thing I do not understand.
>
> I have set the log level to trace+ on my broker and here is what I got
> from the log when I have used the same same addres for python as well as
> for c++ client.
>
> Python:
>
> 2011-08-26 12:13:08 trace
> QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 0:
> {ExchangeQueryBody: name=response; }
> 2011-08-26 12:13:08 trace
> QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 1:
> {QueueQueryBody: queue=response; }
> 2011-08-26 12:13:08 trace
> QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 2:
> {QueueDeclareBody: queue=response.QPID_CLIENT.response_queue_1;
> exclusive=1; auto-delete=1;
> arguments={qpid.max_count:F8:int64(1000),qpid.max_size:F8:int64(1000000),qpid.policy_type:V2:4:str16(ring)};
> }
> 2011-08-26 12:13:08 trace
> QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 3:
> {ExchangeBindBody: queue=response.QPID_CLIENT.response_queue_1;
> exchange=response; binding-key=response.QPID_CLIENT.response_queue_1; }
> 2011-08-26 12:13:08 trace
> QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 4:
> {MessageSubscribeBody: queue=response.QPID_CLIENT.response_queue_1;
> destination=0; accept-mode=0; acquire-mode=0; }
> 2011-08-26 12:13:08 trace
> QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 5:
> {MessageSetFlowModeBody: destination=0; flow-mode=0; }
> 2011-08-26 12:13:08 trace
> QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 6:
> {MessageCancelBody: destination=0; }
> 2011-08-26 12:13:08 trace
> QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 7:
> {QueueDeleteBody: queue=response.QPID_CLIENT.response_queue_1; }
>
> C++:
>
> 2011-08-26 12:15:48 trace
> QPID_CLIENT@QPID9999.a167bd61-8aa3-4900-9ee7-a646bf3c1c63: recv cmd 0:
> {ExecutionSyncBody: }
> 2011-08-26 12:15:48 trace
> QPID_CLIENT@QPID9999.a167bd61-8aa3-4900-9ee7-a646bf3c1c63: recv cmd 1:
> {ExchangeQueryBody: name=response; }
> 2011-08-26 12:15:48 trace
> QPID_CLIENT@QPID9999.a167bd61-8aa3-4900-9ee7-a646bf3c1c63: recv cmd 2:
> {ExchangeDeclareBody: exchange=response; type=topic; alternate-exchange=;
> arguments={}; }
>
> C++ client will get 'ACL denied exchange declare request from
> QPID_CLIENT@QPID9999' from the broker. So to make the C++ client to be
> able to pass through I had to adapt the ACL rules and change the adress as
> stated in my previous email.

Right, the c++ client will issue a declare for the exchange when 
creating a sender or receiver. If 'create' is not enabled the passive 
flag will be true.

The python client doesn't issue this declare, hence the difference in 
ACL rules required at present.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: C++ and Python client diferences

Posted by To...@deutsche-boerse.com.
Hi Gordon,

Thank you for your reply.
But there is still one thing I do not understand.

I have set the log level to trace+ on my broker and here is what I got 
from the log when I have used the same same addres for python as well as 
for c++ client.

Python:

2011-08-26 12:13:08 trace 
QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 0: 
{ExchangeQueryBody: name=response; }
2011-08-26 12:13:08 trace 
QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 1: 
{QueueQueryBody: queue=response; }
2011-08-26 12:13:08 trace 
QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 2: 
{QueueDeclareBody: queue=response.QPID_CLIENT.response_queue_1; 
exclusive=1; auto-delete=1; 
arguments={qpid.max_count:F8:int64(1000),qpid.max_size:F8:int64(1000000),qpid.policy_type:V2:4:str16(ring)}; 
}
2011-08-26 12:13:08 trace 
QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 3: 
{ExchangeBindBody: queue=response.QPID_CLIENT.response_queue_1; 
exchange=response; binding-key=response.QPID_CLIENT.response_queue_1; }
2011-08-26 12:13:08 trace 
QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 4: 
{MessageSubscribeBody: queue=response.QPID_CLIENT.response_queue_1; 
destination=0; accept-mode=0; acquire-mode=0; }
2011-08-26 12:13:08 trace 
QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 5: 
{MessageSetFlowModeBody: destination=0; flow-mode=0; }
2011-08-26 12:13:08 trace 
QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 6: 
{MessageCancelBody: destination=0; }
2011-08-26 12:13:08 trace 
QPID_CLIENT@QPID9999.7ce755ba-f29b-4532-8af9-b52dad8e8450:0: recv cmd 7: 
{QueueDeleteBody: queue=response.QPID_CLIENT.response_queue_1; }

C++:

2011-08-26 12:15:48 trace 
QPID_CLIENT@QPID9999.a167bd61-8aa3-4900-9ee7-a646bf3c1c63: recv cmd 0: 
{ExecutionSyncBody: }
2011-08-26 12:15:48 trace 
QPID_CLIENT@QPID9999.a167bd61-8aa3-4900-9ee7-a646bf3c1c63: recv cmd 1: 
{ExchangeQueryBody: name=response; }
2011-08-26 12:15:48 trace 
QPID_CLIENT@QPID9999.a167bd61-8aa3-4900-9ee7-a646bf3c1c63: recv cmd 2: 
{ExchangeDeclareBody: exchange=response; type=topic; alternate-exchange=; 
arguments={}; }

C++ client will get 'ACL denied exchange declare request from 
QPID_CLIENT@QPID9999' from the broker. So to make the C++ client to be 
able to pass through I had to adapt the ACL rules and change the adress as 
stated in my previous email.

Thanks and regards,
Tomas




Gordon Sim <gs...@redhat.com> 
25/08/2011 14:27
Please respond to
users@qpid.apache.org


To
users@qpid.apache.org
cc

Subject
Re: C++ and Python client diferences







On 08/25/2011 09:57 AM, Tomas.Soltys@deutsche-boerse.com wrote:
> Hi,
>
> I am using qpid 13.0 API (from apache SVN) to build my C++ client and I
> have came across this interesting difference when compared to Python
> client.
>
> So for Python I am using this address:
>
> response/response.QPID_CLIENT.response_queue_1;
> {
>    create: receiver,
>    link:
>    {
>      name: 'response.QPID_CLIENT.response_queue_1',
>      durable: false,
>      x-declare:
>      {
>        auto-delete: true,
>        exclusive: true,
>        arguments:
>        {
>          'qpid.max_count': 1000,
>          'qpid.max_size': 1000000,
>          'qpid.policy_type': ring
>        }
>      }
>    }
> }
>
>
> But for C++ client the address had to be modified to:
>
> response/response.QPID_CLIENT.response_queue_1;
> {
>    assert: never,
>    create: never,
>    node :
>    {
>      type: topic
>    },
>    link:
>    {
>      name: 'response.QPID_CLIENT.response_queue_1',
>      durable: false,
>      x-declare:
>      {
>        auto-delete: true,
>        exclusive: true,
>        arguments:
>        {
>          'qpid.max_count': 1000,
>          'qpid.max_size': 1000000,
>          'qpid.policy_type': ring
>        }
>      }
>    }
> }
>
>
> And I had to add two ACL rules:
>
> acl allow members create exchange name=response passive=true
> acl allow QPID_CLIENT@QPID9999 create  queue name=response.QPID_CLIENT.*
> passive=true
>
>
> Can someone please explain me this difference? Is this expected 
behavior?

I may be missing the difference you are talking about with addressing. I 
believe both of those addresses works the same with each client, though 
the two addresses may do different things.

The key differences in the two are that the second one specifies the 
node type and that the second one does not create the node on demand. 
This will be relevant only when there is no exchange or queue named 
'response'. In this case, both with the python and c++ client, if the 
node is created on first use it will be a queue by default unless you 
specify the node type in which case an exchange will be created.

So if there is an exchange named response, then the two addresses will 
be equivalent. If there is no such exchange (or queue), the first 
address will result in a *queue* named response being created and the 
second will result in a not-found exception.

As to the ACL rules, the c++ client will issue a passive declare when 
creating a sender or receiver for the exchange response. That is why the 
first rule is required. The python client does not do that. We should 
align the steps between the two to make creating ACLs more uniform.

The second rule would be required for using a pre-existing queue whose 
name starts with 'response.QPID_CLIENT'. E.g. were you to remove the 
node type from the second address and run the c++ client with that 
modified address after having first run the python client with the first 
address.

I hope this helps to clarify what you are seeing. If there is some 
difference or unexpected behaviour I have missed please let me know.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org






----------------------------------------------------------------------------
Deutsche Börse Services s.r.o.
Managing Directors/Geschäftsführung:
Michael Gassmann, Mats Andersson.
Limited liability company with registered office at
Sokolovská 662/136B, CZ-186 00 Prague 8
recorded in the Commercial Register IC: 275 77 015.
Maintained by the city court in Prague,
Sec. C, File No. 116874.
-----------------------------------------
Diese E-Mail enthaelt vertrauliche oder rechtlich geschuetzte Informationen.
Wenn Sie nicht der beabsichtigte Empfaenger sind, informieren Sie bitte
sofort den Absender und loeschen Sie diese E-Mail. Das unbefugte Kopieren
dieser E-Mail oder die unbefugte Weitergabe der enthaltenen Informationen
ist nicht gestattet.

The information contained in this message is confidential or protected by
law. If you are not the intended recipient, please contact the sender and
delete this message. Any unauthorised copying of this message or
unauthorised distribution of the information contained herein is prohibited.

Legally required information for business correspondence/
Gesetzliche Pflichtangaben fuer Geschaeftskorrespondenz:
http://deutsche-boerse.com/letterhead

Re: C++ and Python client diferences

Posted by Gordon Sim <gs...@redhat.com>.
On 08/25/2011 09:57 AM, Tomas.Soltys@deutsche-boerse.com wrote:
> Hi,
>
> I am using qpid 13.0 API (from apache SVN) to build my C++ client and I
> have came across this interesting difference when compared to Python
> client.
>
> So for Python I am using this address:
>
> response/response.QPID_CLIENT.response_queue_1;
> {
>    create: receiver,
>    link:
>    {
>      name: 'response.QPID_CLIENT.response_queue_1',
>      durable: false,
>      x-declare:
>      {
>        auto-delete: true,
>        exclusive: true,
>        arguments:
>        {
>          'qpid.max_count': 1000,
>          'qpid.max_size': 1000000,
>          'qpid.policy_type': ring
>        }
>      }
>    }
> }
>
>
> But for C++ client the address had to be modified to:
>
> response/response.QPID_CLIENT.response_queue_1;
> {
>    assert: never,
>    create: never,
>    node :
>    {
>      type: topic
>    },
>    link:
>    {
>      name: 'response.QPID_CLIENT.response_queue_1',
>      durable: false,
>      x-declare:
>      {
>        auto-delete: true,
>        exclusive: true,
>        arguments:
>        {
>          'qpid.max_count': 1000,
>          'qpid.max_size': 1000000,
>          'qpid.policy_type': ring
>        }
>      }
>    }
> }
>
>
> And I had to add two ACL rules:
>
> acl allow members create exchange name=response passive=true
> acl allow QPID_CLIENT@QPID9999 create  queue name=response.QPID_CLIENT.*
> passive=true
>
>
> Can someone please explain me this difference? Is this expected behavior?

I may be missing the difference you are talking about with addressing. I 
believe both of those addresses works the same with each client, though 
the two addresses may do different things.

The key differences in the two are that the second one specifies the 
node type and that the second one does not create the node on demand. 
This will be relevant only when there is no exchange or queue named 
'response'. In this case, both with the python and c++ client, if the 
node is created on first use it will be a queue by default unless you 
specify the node type in which case an exchange will be created.

So if there is an exchange named response, then the two addresses will 
be equivalent. If there is no such exchange (or queue), the first 
address will result in a *queue* named response being created and the 
second will result in a not-found exception.

As to the ACL rules, the c++ client will issue a passive declare when 
creating a sender or receiver for the exchange response. That is why the 
first rule is required. The python client does not do that. We should 
align the steps between the two to make creating ACLs more uniform.

The second rule would be required for using a pre-existing queue whose 
name starts with 'response.QPID_CLIENT'. E.g. were you to remove the 
node type from the second address and run the c++ client with that 
modified address after having first run the python client with the first 
address.

I hope this helps to clarify what you are seeing. If there is some 
difference or unexpected behaviour I have missed please let me know.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org