You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Rick van Rein <ri...@openfortress.nl> on 2020/02/19 09:38:23 UTC

Application properties in Proton Python?

Hi,

I would like to use application-properties in an application using
Proton for Python.  I cannot find how to do that.  Is it implemented?

Is my understanding correct that this is the best place in a design to
put annotations, such as meta-data about the message that are meaningful
to the application though perhaps not to anyone else?

Thanks,
 -Rick

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


Re: Application properties in Proton Python?

Posted by Rick van Rein <ri...@openfortress.nl>.
Ah!

> The difference between a string and a symbol in AMQP is that a symbol
> can only contain valid 7 bit ASCII characters,

I see -- that is another explanation of "taken from a limited set" than what I read in it, the enumerated type.

-Rick

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


Re: Application properties in Proton Python?

Posted by Gordon Sim <gs...@redhat.com>.
On 19/02/2020 1:11 pm, Rick van Rein wrote:
> As I understand it (but that's from the spec), the strings may not have
> arbitrary values but must come from a restricted set.  Like an
> enumerated type, basically.  If the actual implementation just allows
> any string _and_ behaves like it on the wire, then I'm satisfied.  It
> is, once again, a bit confusing (only did one small tool on Proton
> before, you may have guessed my laymanship).

The difference between a string and a symbol in AMQP is that a symbol 
can only contain valid 7 bit ASCII characters, whereas a string can 
contain any utf8. The keys of application-properties in an AMQP message 
are defined to be strings (so any utf8 string is valid).


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


Re: Application properties in Proton Python?

Posted by Rick van Rein <ri...@openfortress.nl>.
Hey Gordon,

Thanks, much clearer now :)

>> I think/thought "properties" is different from "application-properties",
> 
> The 'properties' field on the proton Message object is exclusively
> mapped to application-properties in the amqp message encoding.

OK, thanks very much for assuring that.

> I agree the naming there is confusing!

Yup.  Glad I asked :)  Glad you helped out!

> Yes, but the library should handle the appropriate conversion there.

OK, fine with me.  I do care about the protocol on the wire, for reasons
of compatibility and wanting to do it right.  Code is married to a
library so it may be locally tweaked :)

>> This is typical for "symbol", one from a limited set of values, but I am
>> looking to cover "string", which I expect in application-properties.
> 
> Not sure I understand your concern here completely. The key and value
> can be any arbitrary utf8 string. The value can also be a number if
> preferred.

As I understand it (but that's from the spec), the strings may not have
arbitrary values but must come from a restricted set.  Like an
enumerated type, basically.  If the actual implementation just allows
any string _and_ behaves like it on the wire, then I'm satisfied.  It
is, once again, a bit confusing (only did one small tool on Proton
before, you may have guessed my laymanship).


Thanks for clearing this up!


-Rick

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


Re: Application properties in Proton Python?

Posted by Rick van Rein <ri...@openfortress.nl>.
Hi Robbie,

> Note also that the above links are about two separate areas that do differ.

Yes, you are right, I was really looking for an identifier and got the
two side by side, but shouldn't have.

> The application-properties section within a message (used in proton
> python via the 'properties' field of the message object) does use
> string keys.

Good news :)

> The other link above is about the seperate connection properties
> carried in the Open frame, which uses the fields type and does indeed
> use symbol keys on the wire:

OK.  Even clearer now.

Thanks!
 -Rick

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


Re: Application properties in Proton Python?

Posted by Robbie Gemmell <ro...@gmail.com>.
On Wed, 19 Feb 2020 at 11:33, Gordon Sim <gs...@redhat.com> wrote:
>
> On 19/02/2020 11:15 am, Rick van Rein wrote:
> > Hello Gordon/others,
> >
> > Thanks, but this does not _look_ like the right thing:
> >
> >>> I would like to use application-properties in an application using
> >>> Proton for Python.  I cannot find how to do that.  Is it implemented?
> >
> > I think/thought "properties" is different from "application-properties",
> > because it is described separately in the spec,
> >
> > http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#section-message-format
> >
> > http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-properties
> >
> > Are you saying that the properties get split into those two, and that
> > the Proton API simply treats them in one go?
>
> No, the properties as defined by the AMQP sepc are modelled as
> explicitly named fields on the Message objec, e.g. subject,
> correlation_id etc.
>
> The 'properties' field on the proton Message object is exclusively
> mapped to application-properties in the amqp message encoding.
>
> I agree the naming there is confusing!
>
> > Also, the documentation says that properties have "symbol" types, not
> > "strings" as described in the spec,
> >
> > https://qpid.apache.org/releases/qpid-proton-0.30.0/proton/python/docs/proton.html#proton.Connection.properties
> >
> > http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-application-properties
>
> Yes, but the library should handle the appropriate conversion there.
>

Note also that the above links are about two separate areas that do differ.

The application-properties section within a message (used in proton
python via the 'properties' field of the message object) does use
string keys.

The other link above is about the seperate connection properties
carried in the Open frame, which uses the fields type and does indeed
use symbol keys on the wire:
http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-transport-v1.0-os.html#type-open
http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-transport-v1.0-os.html#type-fields

> >> Yes, it is just called 'properties' but maps to the
> >> application-properties field on the AMQP message. E.g. see here where a
> >> 'colour' property is set on a message:
> >> https://github.com/apache/qpid-proton/blob/master/python/examples/colour_send.py#L45
> >
> > This is typical for "symbol", one from a limited set of values, but I am
> > looking to cover "string", which I expect in application-properties.
>
> Not sure I understand your concern here completely. The key and value
> can be any arbitrary utf8 string. The value can also be a number if
> preferred.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>

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


Re: Application properties in Proton Python?

Posted by Gordon Sim <gs...@redhat.com>.
On 19/02/2020 11:15 am, Rick van Rein wrote:
> Hello Gordon/others,
> 
> Thanks, but this does not _look_ like the right thing:
> 
>>> I would like to use application-properties in an application using
>>> Proton for Python.  I cannot find how to do that.  Is it implemented?
> 
> I think/thought "properties" is different from "application-properties",
> because it is described separately in the spec,
> 
> http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#section-message-format
> 
> http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-properties
> 
> Are you saying that the properties get split into those two, and that
> the Proton API simply treats them in one go?

No, the properties as defined by the AMQP sepc are modelled as 
explicitly named fields on the Message objec, e.g. subject, 
correlation_id etc.

The 'properties' field on the proton Message object is exclusively 
mapped to application-properties in the amqp message encoding.

I agree the naming there is confusing!

> Also, the documentation says that properties have "symbol" types, not
> "strings" as described in the spec,
> 
> https://qpid.apache.org/releases/qpid-proton-0.30.0/proton/python/docs/proton.html#proton.Connection.properties
> 
> http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-application-properties

Yes, but the library should handle the appropriate conversion there.

>> Yes, it is just called 'properties' but maps to the
>> application-properties field on the AMQP message. E.g. see here where a
>> 'colour' property is set on a message:
>> https://github.com/apache/qpid-proton/blob/master/python/examples/colour_send.py#L45
> 
> This is typical for "symbol", one from a limited set of values, but I am
> looking to cover "string", which I expect in application-properties.

Not sure I understand your concern here completely. The key and value 
can be any arbitrary utf8 string. The value can also be a number if 
preferred.


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


Re: Application properties in Proton Python?

Posted by Rick van Rein <ri...@openfortress.nl>.
Hello Gordon/others,

Thanks, but this does not _look_ like the right thing:

>> I would like to use application-properties in an application using
>> Proton for Python.  I cannot find how to do that.  Is it implemented?

I think/thought "properties" is different from "application-properties",
because it is described separately in the spec,

http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#section-message-format

http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-properties

Are you saying that the properties get split into those two, and that
the Proton API simply treats them in one go?

Also, the documentation says that properties have "symbol" types, not
"strings" as described in the spec,

https://qpid.apache.org/releases/qpid-proton-0.30.0/proton/python/docs/proton.html#proton.Connection.properties

http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-application-properties

> Yes, it is just called 'properties' but maps to the
> application-properties field on the AMQP message. E.g. see here where a
> 'colour' property is set on a message:
> https://github.com/apache/qpid-proton/blob/master/python/examples/colour_send.py#L45

This is typical for "symbol", one from a limited set of values, but I am
looking to cover "string", which I expect in application-properties.


So, I'm not totally sure this is what I need.


-Rick

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


Re: Application properties in Proton Python?

Posted by Gordon Sim <gs...@redhat.com>.
On 19/02/2020 9:38 am, Rick van Rein wrote:
> I would like to use application-properties in an application using
> Proton for Python.  I cannot find how to do that.  Is it implemented?

Yes, it is just called 'properties' but maps to the 
application-properties field on the AMQP message. E.g. see here where a 
'colour' property is set on a message: 
https://github.com/apache/qpid-proton/blob/master/python/examples/colour_send.py#L45

> Is my understanding correct that this is the best place in a design to
> put annotations, such as meta-data about the message that are meaningful
> to the application though perhaps not to anyone else?

Yes, I would agree with that.


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