qpid-proton mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Conway <acon...@redhat.com>
Subject Re: Testing types in a message
Date Fri, 15 Feb 2013 15:42:27 GMT
On Fri, 2013-02-15 at 09:12 -0500, Rafael Schloming wrote:
> On Thu, Feb 14, 2013 at 5:44 PM, Alan Conway <aconway@redhat.com> wrote:
> 
> > I'm looking (in python first) to encode messages that contain all the
> > different AMQP types. So far I was using the Data class to construct
> > different AMQP data fragments. However I'd like to move towards using a
> > map message as it's more widely decodable. So my question: how do I
> > create a map message that contains specific AMQP types?  I.e. I want to
> > differentiate between shorts, ints and longs, between symbols and
> > strings etc. Just setting message.body = Data(...) does not work,
> > message wants to have a python dict or list as a body.
> >
> 
> For the python binding I've defined the following classes to cover types
> that python doesn't natively support:
> 
> class UnmappedType
> class ulong(long)
> class timestamp(long)
> class symbol(unicode)
> class char(unicode)
> class Described(object)
> UNDESCRIBED = Constant("UNDESCRIBED")
> class Array(object)
> 
> So you should just be able to do:
> 
> message.body = {u"ulong": ulong(1234), u"char": char(u"\u1234"),
> u"timestamp": timestamp(12345678), u"described-string":
> Described(symbol("url-descriptor"), u"http://blah"), u"array":
> Array(UNDESCRIBED, Data.INT, 1, 2, 3, 4), u"described-array":
> Array(symbol("url-descriptor"), u"http://blah1", u"http://blah2")}
> 
> --Rafael

I'm all good with the python binding. Now I'm trying to figure out what
to do with Java (JNI and native), and soon with perl, php and ruby.

For Java JNI I can use the Data object the same way I did in python, but
Java native is a different story. In the jython test, all the codec test
functions just throw unsupported-operation in the proton-j profile.

proton_tests.codec.DataTest.testBinary .................................. skip
  ProtonUnsupportedOperationException:
org.apache.qpid.proton.ProtonUnsupportedOperationException

So I'm not sure how/if I can express AMQP types in proton-j.

Cheers,
Alan.


Mime
View raw message